My site is at http://example.com, and I want
http://example.com/mytgproject to be my TG project.
I followed the instructions on the cherrypy wiki to set up a proxy.
Here's the relevant apache config:
<Location /mytgproject>
ProxyPass http://localhost:8080
ProxyPassReverse http://localhost:8080
RequestHeader set CP-Location /mytgproject
AllowOverride None
Order Deny,Allow
Allow from all
</Location>
Now, I can hit my TG site from either http://example.com:8080 or from
http://example.com/mytgproject. Everything works EXCEPT that widgets
try to source in javascript from the root URL of my site, not the
subdirectory.
I added this to the bottom of my app.cfg, but I don't understand what
it means, and it didn't seem to solve the problem:
[/]
base_url_filter.on = True
base_url_filter.use_x_forwarded_host = True
[P]
So, I'm out of ideas. Any help would be really useful.
TIA
Matt
The only thing I've been able to make work reliably is this:
<Location /mytgproject>
ProxyPass http://localhost:8080/mytgproject
ProxyPassReverse http://localhost:8080/mytgproject
RequestHeader set CP-Location /mytgproject
</Location>
And in dev.cfg:
server.webpath = '/mytgproject'
But you also have to use ${tg.url('/foo')} everywhere to have the
server.webpath value prefixed to absolute URLs. Except when you
raise redirect('/foo'), which (incorrectly, IMHO) always does
this for you.
I also just notice that TG or CherryPy has a (mis)feature where it
will happily duplicate content for server.webpath at the root, too.
So missing tg.url()s won't matter until you access the site through
Apache.
I'm still looking for a better solution :(
What would be a better solution? I can't really think of anything that
helps you get correct URLs and still makes it equally easy to reference
other parts of the site.
-Adam
I haven't done enough web development to say. If this is the
Right Way, I'd be happy to provide patches and documentation to
make it work out of the box.
-Neil