[Twisted-web] Nevow and distrib

David Reid dreid at dreid.org
Mon Jul 12 05:46:03 MDT 2004


Upon closer inspection proxy.py would need a little work to get it to
work with Nevow and/or new-web.  It returns server.NOT_DONE_YET which
isn't supported by either that I recall.  It also depends on
http.HTTPClient which isn't present in new-web.  

I don't suggest people actually use new-web yet so that's not a big
deal.  But proxy.py should almost definitely add the port (if
present/not '80') to the host header.

--David

On Mon, 2004-07-12 at 02:51, Matt Goodall wrote:
> On Mon, 2004-07-12 at 06:21, David Reid wrote:
> > Much more interesting, is the new-web/twisted/web/proxy.py which moshez
> > rewrote to allow support of both TCP and Unix sockets.
> > In a much cleaner way than my distrib.py hackery.
> 
> Yes, that does look good. However, there's nothing which tells the Nevow
> app what URL it is actually working behind which means generated URLs
> are incorrect. Now, if proxy also set the 'x-forwarded-from' header then
> the Nevow app would work just the same. Hmm, it records 'host' in the
> request headers ... perhaps that's supposed to include the port too?
> 
> Anyway, thanks for mentioning this.
> 
> Cheers, Matt
> 
> > 
> > -David
> > 
> > On Sun, 2004-07-11 at 20:01, Matt Goodall wrote:
> > > Hi all,
> > > 
> > > Attached is a distrib module and a patch to nevow/appserver.py that
> > > allows Nevow to work behind a distrib server. Yippee! I claim no credit
> > > for the distrib module, I ripped it from new-web. The change to
> > > appserver.py is almost certainly not robust enough but ti works for a
> > > simple distrib server. Patches will be most welcome as you fix the
> > > bugs ;-).
> > > 
> > > You don't need a Publisher with this as it's all proxy based. I imagine
> > > the proxy will work over a UNIX socket but I only tested over TCP. Below
> > > is the server I used to test:
> > > 
> > > from twisted.application import service
> > > from twisted.application import internet
> > > from nevow import appserver, distrib
> > > 
> > > application = service.Application('distribtest')
> > > internet.TCPServer(
> > >     8000,
> > >     appserver.NevowSite(
> > >         distrib.ResourceSubscription('localhost', 8001)
> > >     )
> > > ).setServiceParent(application)
> > > 
> > > Also, I imagine it's relatively easy to use the same technique to hide a
> > > Nevow app behind Apache. It's just a matter of adding a 'x-forwarded-
> > > from' header to the request before proxying it to the twistd server (see
> > > distrib.py). mod_proxy + mod_headers should help, maybe mod_rewrite too.
> > > 
> > > Hope this is of interest.
> > > 
> > > Cheers, Matt
> > > 
> > 
> > ______________________________________________________________________
> > _______________________________________________
> > Twisted-web mailing list
> > Twisted-web at twistedmatrix.com
> > http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://pyramid.twistedmatrix.com/pipermail/twisted-web/attachments/20040712/f5c6f5fc/attachment.bin


More information about the Twisted-web mailing list