Use web2py as a reverse proxy

150 views
Skip to first unread message

LoveWeb2py

unread,
Feb 12, 2018, 9:43:53 PM2/12/18
to web2py-users
Django has a reverse proxy module... Wondering if web2py has something similar?

I want to make web2py the single interface to multiple applications.

Any help is appreciated :)

Anthony

unread,
Feb 13, 2018, 7:10:26 AM2/13/18
to web2py-users
On Monday, February 12, 2018 at 9:43:53 PM UTC-5, LoveWeb2py wrote:
Django has a reverse proxy module... Wondering if web2py has something similar?

I don't think so.
 
I want to make web2py the single interface to multiple applications.

Can you explain further what you are trying to do? Why not use something like Nginx as a reverse proxy?

Anthony

Manuele Pesenti

unread,
Feb 13, 2018, 9:32:57 AM2/13/18
to web...@googlegroups.com

I wrote something like that few years ago... maybe you can start from here:

https://gist.github.com/manuelep/81ffe8ce57de4dc9b2d80a99c08992cc

please let me know if you find any interest in it.

Cheers

    Manuele

LoveWeb2py

unread,
Feb 13, 2018, 10:15:13 PM2/13/18
to web2py-users
Where did you use this or how did you use your version of the proxy Manuele? Thank you for sharing!

Anthony - we want web2py to be the only interface to docker containers.

Anthony

unread,
Feb 14, 2018, 7:37:55 AM2/14/18
to web2py-users
On Tuesday, February 13, 2018 at 10:15:13 PM UTC-5, LoveWeb2py wrote:
Where did you use this or how did you use your version of the proxy Manuele? Thank you for sharing!

Anthony - we want web2py to be the only interface to docker containers.

Is there some web2py specific operations you need to happen between the client and the destination server (e.g., web2py authentication/authorization)? Otherwise, web2py is probably not the most efficient way to proxy HTTP requests. How are you serving web2py itself? 

LoveWeb2py

unread,
Feb 14, 2018, 9:14:25 AM2/14/18
to web2py-users
We serve web2py through nginx.

I'm curious how django was able to do it. We have multiple apps running in docker containers and want web2py to be the portal. That way we can use auth.

Manuele Pesenti

unread,
Feb 14, 2018, 9:27:10 AM2/14/18
to web...@googlegroups.com

Hi Anthony and LoveWeb2py,

I used this controller exactly to let authenticated and authorized users access to a third part application not exposed to the web, I shared in order to collect opinions from experts, any suggest appreciated.

Cheers

    Manuele

Anthony

unread,
Feb 14, 2018, 9:51:29 AM2/14/18
to web2py-users
On Wednesday, February 14, 2018 at 9:14:25 AM UTC-5, LoveWeb2py wrote:
We serve web2py through nginx.

I'm curious how django was able to do it.  We have multiple apps running in docker containers and want web2py to be the portal.  That way we can use auth.


Got it. Another option might be to proxy directly from Nginx to the other apps, and just use web2py as a CAS provider for authentication (see http://web2py.com/books/default/chapter/29/09/access-control#Central-Authentication-Service).

Anthony
 

Anthony

unread,
Feb 14, 2018, 10:24:13 AM2/14/18
to web2py-users

Anthony

unread,
Feb 14, 2018, 10:45:58 AM2/14/18
to web2py-users

So, in web2py you just need to set up an action to check for login and return either a 200 response or a 401 or 403. Nginx will then check that action on each request and manage the redirect to the web2py login page if the user is not logged in. This is still not the most efficient approach, as every request is still hitting web2py. Using web2py as a CAS provider is probably better, though it will require the other apps to implement an authentication check and redirect to the web2py application for login, etc.

Anthony

Dave S

unread,
Feb 14, 2018, 4:10:34 PM2/14/18
to web2py-users


On Wednesday, February 14, 2018 at 6:14:25 AM UTC-8, LoveWeb2py wrote:
We serve web2py through nginx.

I'm curious how django was able to do it.  We have multiple apps running in docker containers and want web2py to be the portal.  That way we can use auth.


Are the docker containers running webservers, or are you sending RPC-like commands that (in effect) exec something in the docker?

/dps
 

LoveWeb2py

unread,
Feb 14, 2018, 4:27:29 PM2/14/18
to web2py-users
Yeah, docker containers have kibana and a couple other similar web services
Reply all
Reply to author
Forward
0 new messages