[Twisted-web] Nevow liveglue and proxy
Thomas HERVE
therve at free.fr
Thu Mar 24 05:26:13 MST 2005
Quoting Thomas HERVE <therve at free.fr>:
> Quoting Matt Goodall <matt at 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.
--
Thomas
More information about the Twisted-web
mailing list