[Twisted-Python] Ramblings about creating URLs in Twisted Web
![](https://secure.gravatar.com/avatar/74bde9dd414c74dc244c6a448e5decc6.jpg?s=120&d=mm&r=g)
Just thought I'd let people know I posted a fairly long piece about the problems inherent with creating URLs in Twisted Web, and a hopeful solution: http://www.ulaluma.com/pyx/archives/000581.html BTW, if anyone has a better moveabletype template, or a good Blog written in Python (and twisted? :) I would like to expend as little energy as possible with perl-related software but still have a nice Blog... dp
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Sat, 28 Jun 2003 11:49:42 -0700 Donovan Preston <dp@twistedmatrix.com> wrote:
One way to do reverse proxying that works correctly is to use what Zope calls VirtualHostMonster - you pass the real domain and path as part of a rewritten Zope server and it extracts them and mangles the reqyest correctly. Twisted currently supports this for domains (though not paths, the code needs to be extended) using some code which is in twisted.web.vhost IIRC. twisted-web does this out of the box, so you can do: <VirtualHost 1.2.3.4> ServerName www.example.com ProxyPass / http://localhost:8234/vhost/http/www.example.com:80/ </VirtualHost> in apache, which will forward requests to the twisted-web server and DTRT regarding the request generated URLs. -- Itamar Shtull-Trauring http://itamarst.org/ http://www.zoteca.com -- Python & Twisted consulting
![](https://secure.gravatar.com/avatar/74bde9dd414c74dc244c6a448e5decc6.jpg?s=120&d=mm&r=g)
On Saturday, June 28, 2003, at 3:18PM, Itamar Shtull-Trauring wrote:
<snip> Yes, I am aware of twisted.web.vhost and this is simply a slight variation on the ProxyPass method I was discussing in my post. I am suggesting that whatever code in Twisted which is responsible for generating URLPath instances (a method on the request, perhaps) be aware of this and handle it properly, isolating the Woven programmer from the details of the configuration of the web server. Incidentally, if Apache sets the x-forwarded-host header upon requesting the page from the proxy, why is it necessary to pass this information on to the proxy as a part of the url? dp
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Sat, 28 Jun 2003 17:03:59 -0700 Donovan Preston <dp@twistedmatrix.com> wrote:
Because that's just the host, not the path, i.e. what if you're proxyhosting not www.example.com but www.example.com/foo? -- Itamar Shtull-Trauring http://itamarst.org/ http://www.zoteca.com -- Python & Twisted consulting
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Sat, 28 Jun 2003 11:49:42 -0700 Donovan Preston <dp@twistedmatrix.com> wrote:
One way to do reverse proxying that works correctly is to use what Zope calls VirtualHostMonster - you pass the real domain and path as part of a rewritten Zope server and it extracts them and mangles the reqyest correctly. Twisted currently supports this for domains (though not paths, the code needs to be extended) using some code which is in twisted.web.vhost IIRC. twisted-web does this out of the box, so you can do: <VirtualHost 1.2.3.4> ServerName www.example.com ProxyPass / http://localhost:8234/vhost/http/www.example.com:80/ </VirtualHost> in apache, which will forward requests to the twisted-web server and DTRT regarding the request generated URLs. -- Itamar Shtull-Trauring http://itamarst.org/ http://www.zoteca.com -- Python & Twisted consulting
![](https://secure.gravatar.com/avatar/74bde9dd414c74dc244c6a448e5decc6.jpg?s=120&d=mm&r=g)
On Saturday, June 28, 2003, at 3:18PM, Itamar Shtull-Trauring wrote:
<snip> Yes, I am aware of twisted.web.vhost and this is simply a slight variation on the ProxyPass method I was discussing in my post. I am suggesting that whatever code in Twisted which is responsible for generating URLPath instances (a method on the request, perhaps) be aware of this and handle it properly, isolating the Woven programmer from the details of the configuration of the web server. Incidentally, if Apache sets the x-forwarded-host header upon requesting the page from the proxy, why is it necessary to pass this information on to the proxy as a part of the url? dp
![](https://secure.gravatar.com/avatar/d7875f8cfd8ba9262bfff2bf6f6f9b35.jpg?s=120&d=mm&r=g)
On Sat, 28 Jun 2003 17:03:59 -0700 Donovan Preston <dp@twistedmatrix.com> wrote:
Because that's just the host, not the path, i.e. what if you're proxyhosting not www.example.com but www.example.com/foo? -- Itamar Shtull-Trauring http://itamarst.org/ http://www.zoteca.com -- Python & Twisted consulting
participants (2)
-
Donovan Preston
-
Itamar Shtull-Trauring