[Twisted-Python] Problem with ReverseProxy and POST requests

Lance Kurisaki lkurisaki at ambiron.net
Mon Jun 2 13:03:53 EDT 2003

I'm trying to use the Reverse Proxy, and found that the example
(proxy.py) works fine for GET requests, but not for POSTs. The problem
was that the body of the POST was not being forwarded, so the request
would hang while the destination server waited for the rest of the body.

I fixed it with the following patch to the ReverseProxyResource method
in the module twisted.web.proxy.


Index: twisted/web/proxy.py
RCS file: /cvs/Twisted/twisted/web/proxy.py,v
retrieving revision 1.11
diff -c -r1.11 proxy.py
*** twisted/web/proxy.py        8 Jan 2003 14:18:56 -0000       1.11
--- twisted/web/proxy.py        2 Jun 2003 16:54:36 -0000
*** 178,183 ****
--- 178,184 ----

      def render(self, request):
          request.received_headers['host'] = self.host
+         request.content.seek(0, 0)
          clientFactory = ProxyClientFactory(request.method, self.path,

More information about the Twisted-Python mailing list