So I changed my reverse proxy set up to make debug a bit easier and maybe 
will get some suggestions from someone now:

I have an instance of web2py running on nginx sitting behind an apache 
reverse proxy so:

www.mydomain.com/link        points to    myserver1.otherdomain.com

i have /myapp/default/index set as the default application, controller, and 
function.  When i go directly to myserver1.otherdomain.com everything works 
as expected. If i go to www.mydomain.com/link all of my static files are 
unreachable because the relative paths point to 
www.mydomain.com/myapp/static/file where really it would have to be 
www.mydomain.com/link/myapp/static/file.  I am using URL() to create 
relative links.

Looking at routes.py it seems like I should be setting BASE = 'link'

When I do this going to www.mydomain.com/link works 
(www.mydomain.com/link/doesn't), but the site as a whole doesn't.  For example, 
if I try to log 
in, that page loses its static files.  Looking at what the static files now 
point to I get this which is clearly wrong:

http://www.mydomain.com/link/myapp/default/user/link/myapp/static/images/favicon.ico

Another example going to a simple page /myapp/default/learn

http://www.mydomain.com/link/myapp/default/link/myapp/static/js/modernizr.custom.js


It looks like urls are getting re-written twice or something?  Does anyone 
have any suggestions on how to configure a web2py application to work 
behind a reverse proxy?

Dean




On Tuesday, November 5, 2013 11:51:11 AM UTC-5, DeanK wrote:
>
> I have an instance of web2py running on nginx sitting behind an apache 
> reverse proxy (soon to be nginx as well) so:
>
> www.mydomain.com/myapp        points to >>    myserver1.otherdomain.com
>
> i have /myapp/default/landing set as the default application, controller, 
> and function.  When i go directly to myserver1.otherdomain.com everything 
> is fine, but if i go to www.mydomain.com/myapp all of my static files are 
> unreachable because the relative paths point to 
> www.mydomain.com/myapp/static/file where really it would have to be 
> www.mydomain.com/myapp/myapp/static/file which is kind of ugly.  I am 
> using URL() to create relative links.
>
> I first though maybe the fact the the reverse proxy url and app names are 
> the same was confusing regex or whatever was doing the rewrites, but that 
> didn't seem to be the case.  I also started looking at routes.py and set 
> BASE = 'myapp'.  That made parts of my site work, but things like login 
> then didn't.
>
>
> Anyone have experience setting a web2py app up behind a reverse proxy? 
>  Thoughts? Thanks,
>
> Dean
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to