[Twisted-Python] HTTP 302 instead of just delivering the content.

David Reid dreid at dreid.org
Tue Sep 12 08:25:29 MDT 2006


On Tue, Sep 12, 2006 at 10:41:16AM +0200, Markus Schiltknecht wrote:
> Hi,
> 
> Phil Mayers wrote:
> >You need a vhostmonster
> 
> Thank you, I didn't think about a vhostmonster, because I don't want to 
> serve multiple vhosts. I only want to serve _one_ website. It gets 
> accessed from different URLs, though.
> 
> As I'm using nevow, I think I have to use the nevow vhost thingie:
> 
> from nevow import appserver
> from nevow import vhost

Nevow has a VHostMonster.
 
> root = vhost.NameVirtualHost()
> 
> webroot = Website('sites')
> webroot.putChild('xxxxxx.ch', root)
> webroot.putChild('www.xxxxxx.ch', root)

What do you expect this to do?  

> site = appserver.NevowSite(webroot)
> webserver = internet.TCPServer(8083, site)
> 
> application = service.Application('ulmann website')
> webserver.setServiceParent(application)

See:
http://twistedmatrix.com/projects/web/documentation/howto/using-twistedweb.html#auto21
The usage is exactly the same for Nevow's VHostMonster.
 
> But, that works as before: it still redirects to port 8083 instead of 
> just ignoring the HTTP Host: Header field.
> 
> Can't I just tell twisted web to ignore that? Without VHostMonsters and 
> stuff like that? IMHO twisted should not mind and just serve what it's 
> told to serve on port 8083. And let apache do the reverse proxying.

It's an issue of URL generation from the request object.  There is no
good way to make the right thing just magically happen.  Because as
usual your right thing will be different from someone elses.
VHostMonster is an atrocity though, someone should seriously consider
backporting the *VHostURIRewrite resources in twisted.web2.vhost.

I'll go get the bear.

-David

-- 
"Usually the protocol is this: I appoint someone for a task,
which they are not qualified to do.  Then, they have to fight
a bear if they don't want to do it." -- Glyph Lefkowitz




More information about the Twisted-Python mailing list