base url and tools.proxy?

35 views
Skip to first unread message

Shawn

unread,
Jul 16, 2008, 3:17:20 PM7/16/08
to cherrypy-users
I have cherrypy setup behind an Apache reverse proxy.

When my application generates links using cherrypy.url() I need them
to reflect the proxy's path information, etc.

When reading this page:

http://cherrypy.org/wiki/BuiltinTools#tools.proxy

It seems to indicate that I would have to hard-code the path
information in the configuration for my cherrypy application.

Is there no dynamic way to do this given that it can already handle
scheme://host[:port] ?

Thanks,
-Shawn

Robert Brewer

unread,
Jul 16, 2008, 3:55:40 PM7/16/08
to cherryp...@googlegroups.com

If you can find a way for Apache to send the path info (say, in an
X-header) to CP, then it should be a snap to write a clone of
tools.proxy that looks for that and sets request.base correctly. But as
far as I know, that magical X-header doesn't exist. If you find it does
and is common, we'd be happy to incorporate it into tools.proxy.


Robert Brewer
fuma...@aminus.org

Eric Larson

unread,
Jul 17, 2008, 1:04:17 PM7/17/08
to cherryp...@googlegroups.com

Ian Bicking found the same lack of a path header when I discussed a
similar issue with some paste middleware. I mention it because if
there is a way to get that path info, it would be really helpful for
any WSGI based application. I personally never found a good way to do
it other than explicitly specifying the base URL.

Good luck!

Eric Larson

>
> Robert Brewer
> fuma...@aminus.org
>
>
> >
>

Reply all
Reply to author
Forward
0 new messages