On Sun, 10 Jun 2007 17:32:47 +0200, Markus Schiltknecht
Hi,
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
and:
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...
You're going about this wrong, unfortunately. "Twisted" won't issue a redirect based on the Host header. Even "twisted.web" won't do that. Some resource provided by twisted.web (or nevow, I forget what you're using) might, but only if you put it into your resource hierarchy. Perhaps you could elaborate on how and of what your Site is constructed? A minimal code example would be ideal, since it communicates exactly the problem you're having, instead of relying on the imperfect ability of other people to translate a prose description of a program back into the same program. Jean-Paul