web2py and reverse proxy. How to expose a single application behind a hostname

36 views
Skip to first unread message

Manuele Pesenti

unread,
Jan 20, 2020, 11:49:13 AM1/20/20
to web2py-users
Hi!

For our deploy installation I followed successfully the procedures in
documentation so now I have my server exposing the web2py root, now I
tried to configure a second host name using an apache reverse proxy
configuration to serve directly a specific application, is it possible?

Let's say my application is reachable under apps.mycompany.com/myapp and
now I want to setup the virtualhost myapp.mycompany.com as a reverse
proxy to direcly serve the app. I've used this apache proxy configuration:

<VirtualHost *:443>
  ServerName myapp.mycompany.com
  SSLProxyEngine On
  ProxyRequests Off
  SSLProxyCheckPeerName off
  <Proxy *>
      Order Deny,Allow
      Allow from all
  </Proxy>

  ProxyPass "/" "https://<myip>/myapp/"
  ProxyPassReverse "/" "https://<myip>/myapp/"

  SSLCertificateFile
/etc/letsencrypt/live/analytics.colouree.com/fullchain.pem
  SSLCertificateKeyFile
/etc/letsencrypt/live/analytics.colouree.com/privkey.pem

  CustomLog /var/log/apache2/ssl-analytics-access.log common
  ErrorLog /var/log/apache2/analytics-error.log

</VirtualHost>

The problem is that every link included in the page contains even the
application name such as:

https://analytics.colouree.com/welcome/static/css/bootstrap.min.css and
so on.

Is there a possible way to fix it with some framework configuration?

Thank you very much.

Best regards

    Manuele

Dave S

unread,
Jan 21, 2020, 3:45:46 AM1/21/20
to web2py-users


On Monday, January 20, 2020 at 8:49:13 AM UTC-8, Manuele wrote:
Hi!

For our deploy installation I followed successfully the procedures in
documentation so now I have my server exposing the web2py root, now I
tried to configure a second host name using an apache reverse proxy
configuration to serve directly a specific application, is it possible?

Let's say my application is reachable under apps.mycompany.com/myapp and
now I want to setup the virtualhost myapp.mycompany.com as a reverse
proxy to direcly serve the app. I've used this apache proxy configuration:

<VirtualHost *:443>
   ServerName myapp.mycompany.com
[...] 
</VirtualHost>

The problem is that every link included in the page contains even the
application name such as:

https://analytics.colouree.com/welcome/static/css/bootstrap.min.css and
so on.

Is there a possible way to fix it with some framework configuration?


Check out routes.py, as described at
<URL:http://www.web2py.com/books/default/chapter/29/04/the-core#URL-rewrite>

/dps

Manuele Pesenti

unread,
Jan 21, 2020, 6:24:14 AM1/21/20
to web...@googlegroups.com
Yes! It seams the right way... thank you Dave

    M.
Reply all
Reply to author
Forward
0 new messages