SIP
change webroot possible - Printable Version

+- SIP (https://nosack.com/sipforum)
+-- Forum: SIP (Sustainable Irrigation Platform) (https://nosack.com/sipforum/forumdisplay.php?fid=1)
+--- Forum: Installation and set up questions (https://nosack.com/sipforum/forumdisplay.php?fid=2)
+--- Thread: change webroot possible (/showthread.php?tid=157)



change webroot possible - astrogerard - 2019 Jun 08

Hi,

I would like to change the webroot from / to /sip
Is this possible by config?  I have seen urls.py but changing that seems to be not update proof. Hopefully it can be done without external components.

The reason I ask this is that I'm busy protecting all my services and placing them behind a reverse proxy and use Keycloak for authorization (openid-connect) and 2FA. SIP is one of the last to do and having the services at a separate root would be very helpful.

Thanks,
Gerard


RE: change webroot possible - dan - 2019 Jun 08

Hi Gerard,

You might find the answer in the Web.py docs:
http://webpy.org/cookbook/url_handling

Especially check the web.ctx reference.


RE: change webroot possible - astrogerard - 2019 Jun 09

Thanks Dan,

As far as I can see it is quit a bit of work to do this. I hoped it could be done with some minor config changes.

For now I will try to remap the urls by the proxy.


RE: change webroot possible - astrogerard - 2019 Jun 14

For those who are interested in this topic (if any Wink ). 

Changing the webroot via a reverse proxy is easy. Hints are already in ReverseProxied.py.
In this case I use Nginx with the following few lines of config. 

Code:
location /sip {
               proxy_pass http://<ip of sip>:<port>;
               proxy_set_header Host $host;
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
               proxy_set_header X-Forwarded-Proto $scheme;
               proxy_set_header X-Script-Name /sip;
               }
location /sip/static {
               proxy_pass http://<ip of sip>:<port>/static;
               proxy_set_header Host $host;
               proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
               proxy_set_header X-Forwarded-Proto $scheme;
               proxy_set_header X-Script-Name /sip/static;
               }