Skip to content

Hsproxy configuration

Raitis Berzins edited this page Jan 21, 2019 · 15 revisions

Hsproxy is a cgi python script, which helps to overcome CORS restrictions in wms and ajax requests.

Running hsproxy through uwsgi + nginx

Compile uwsg with cgi support as described here https://uwsgi-docs.readthedocs.io/en/latest/CGI.html

curl http://uwsgi.it/install | bash -s cgi /tmp/uwsgi

(Doesn't have to be /tmp, but absolute path is necessary)

Create a cgi.ini file for uwsgi configuration with content:

#plugins = cgi
socket = /tmp/uwsgi.sock
cgi = /cgi-bin=/srv/http/cgi-bin
chmod-socket = 664
uid = http
gid = http

Download hsproxy.cgi script and put it into /srv/http/cgi-bin:

curl https://raw.githubusercontent.com/hslayers/hslayers-ng/develop/lib/hsproxy_py3.cgi --output /srv/http/cgi-bin/hsproxy.cgi

Launch uwsgi

sudo /tmp/uwsgi --ini cgi.ini

Add config to server section of nginx.conf

location /cgi-bin/ {
    include uwsgi_params;
    uwsgi_modifier1 9;
    uwsgi_pass unix:///tmp/uwsgi.sock;
}

restart nginx

http://localhost/cgi-bin/hsproxy.cgi should give you

Some unexpected error occurred. Error text was: 'NoneType' object has no attribute 'split' hsproxy.cgi 152 Thats good!

Clone this wiki locally