I've just updated to nevow 0.4.1 and I enjoy the improvements, especially on the LivePage API. But i've found something that doesn't work for me in the new way to render livepage "glue" : the render_liveglue method uses the url.here() function, and as I'm using an Apache proxy to access the site it gives me "http://localhost:8080%5B...]" instead of the URL I'm accessing.
For now I've set manually the liveglue.js in my header, and I think it's a clean way to do it, but I was wondering if there was a another way to get "good" URL (which means the one the browser see).
Anyway thanks for that great work !
Thomas HERVE wrote:
I've just updated to nevow 0.4.1 and I enjoy the improvements, especially on the LivePage API. But i've found something that doesn't work for me in the new way to render livepage "glue" : the render_liveglue method uses the url.here() function, and as I'm using an Apache proxy to access the site it gives me "http://localhost:8080%5B...]" instead of the URL I'm accessing.
For now I've set manually the liveglue.js in my header, and I think it's a clean way to do it, but I was wondering if there was a another way to get "good" URL (which means the one the browser see).
Anyway thanks for that great work !
This is a common problem with proxied applications. It affects anything that generates URLs.
You need to add a nevow.vhost.VHostMonsterResource to your site. See the docstring for details, including how to configure the Apache proxy.
Cheers, Matt
Quoting Matt Goodall matt@pollenation.net:
This is a common problem with proxied applications. It affects anything that generates URLs.
You need to add a nevow.vhost.VHostMonsterResource to your site. See the docstring for details, including how to configure the Apache proxy.
Well in fact I use a resource wrapped in a guard.SessionWrapper to get the authentication functionnality, and the only solution I've seen for using vhosts is the small hack found here : http://twistedmatrix.com/pipermail/twisted-web/2004-October/000801.html. There's not seem to have a clean solution for this problem, and I'm not (yet :)) able to judge if I should use this.
Quoting Thomas HERVE therve@free.fr:
Quoting Matt Goodall matt@pollenation.net:
You need to add a nevow.vhost.VHostMonsterResource to your site. See the docstring for details, including how to configure the Apache proxy.
Well in fact I use a resource wrapped in a guard.SessionWrapper to get the authentication functionnality, and the only solution I've seen for using vhosts is the small hack found here : http://twistedmatrix.com/pipermail/twisted-web/2004-October/000801.html. There's not seem to have a clean solution for this problem, and I'm not (yet :)) able to judge if I should use this.
As always, it's faster to talk than it is to search, and I found a solution in svn sandbox, in tv/monsterguard. It "simply" uses an intermediate root page to declare the VHostMonster.
I looks like this : In apache configuration : ProxyPass /app http://localhost:8080/vhost/http/www.example.com/app
In tac file : # Start code realm = mysite.MyRealm() portal = portal.Portal(realm) portal.registerChecker(checkers.AllowAnonymousAccess(), credentials.IAnonymous) portal.registerChecker(mysite.MyCredChecker())
// Create a small static page, should not be accessed root = static.Data('This is the private server, not accessible from the Internet. It hosts <a href="app/">app</a>', 'text/html') root.putChild('', root) root.putChild('vhost', vhost.VHostMonsterResource()) root.putChild('app', guard.SessionWrapper(portal, mindFactory=livepage.LivePage))
// MySite is an appserver.Site site = mysite.MySite(root)
application = service.Application("mysite") internet.TCPServer(8080, site).setServiceParent(application) # END Code
Et voila.