[Twisted-web] disabling redirection

Markus Schiltknecht markus at bluegap.ch
Sun Jun 10 11:32:47 EDT 2007


Colin Alston wrote:
> What is the basis for using Varnish as opposed to just serving up with 
> Twisted directly?

Uh.. server side caching, reverse proxying... Why does that need more 
explanation? Why should I do that with twisted, if varnish is better at 
being a reverse proxy (assuming that twisted also offers a caching 
module, which I'm guessing)?

Besides, varnish does a very good job with virtual hosts and multiple 
backends (web servers), given that I'm not exclusively running twisted, 
but other web servers as well. (And running one twisted instance per 
virtual website.)

> Perhaps you should point out just exactly where and when you're 
> experiencing problems with URL rewrites. I've never experienced any of 
> these problems deploying either with a simple reverse proxy or the 
> VHostMonstorResource. It used to be a problem specifically with Guard 
> but these issues seem to have dissolved over the current versions.

Maybe I'm just missing an example...

What I want is pretty simple: I want twisted to serve the URL which I 
requested in the HTTP requests top line, no matter what the Host: header 
says, i.e. the following two requests:

GET /sample.html HTTP/1.0
Host: localhost:8080


GET /sample.html HTTP/1.0
Host: www.postgres-r.org

..should both deliver the same sample.html file. And *not* a redirect to 
whatever twisted thinks is it's hostname and port.

If twisted could simply ignore the 'Host' field, that would be fine. If 
I could tell it, what Hosts it should accept (instead of only accepting 
'localhost:8080') and what not (i.e. it should probably redirect 
'postgres-r.org' to 'www.postgres-r.org'), that would be extra super!

Maybe, someone could simply point me to the python file where twisted 
does the hostname and port checking and the redirection? That would 
already help...



More information about the Twisted-web mailing list