[Twisted-web] Twisted and reverse proxies

Ray Cote rgacote at appropriatesolutions.com
Tue Mar 30 21:50:55 EDT 2010

Hi Rob: 

We have a number of different installations running precisely that arrangement -- Twisted running behind Apache (or Nginx). Very stable and reliable.

One note, you ask how your static resources 'will react' to being reverse proxied. 
When running Twisted behind Apache, we find it most useful to serve all the static files directly from Apache and leave Twisted to serve only the dynamic content. No reason to use Twisted to serve static files when there's a perfectly good Apache server available. 

The one small issue we've had is that all the log entries in Twisted come out showing a source IP of (i.e., the Apache server). We turned on the X-Forwarded headers in Apache and ended up hacking some library code in Twisted, but always figured we must have missed something since it seems that grabbing the X-Forwarded header should either a) be something Twisted would do; or b) have a simple setting to indicate the use of X-Forwarded. (perhaps some more knowledgeable person will point me in the right direction.)

----- Original Message -----
From: "Rob Newman" <rlnewman at ucsd.edu>
To: twisted-web at twistedmatrix.com
Sent: Tuesday, March 30, 2010 7:52:46 PM GMT -05:00 US/Canada Eastern
Subject: [Twisted-web] Twisted and reverse proxies

Hi Twisted folks,

We have a pure Twisted application that runs on a URL akin to:


We wish to use an Apache reverse proxy to allow our web users to transparently view the Twisted application 'within' our existing Apache served site. So that, something like:


proxies to:


As someone relatively new to Twisted, how will our static (and other) resources react to being reverse proxy served? Will they barf? Is there any online documentation I can look at for case studies?

Thanks in advance,
- Rob
Twisted-web mailing list
Twisted-web at twistedmatrix.com

Ray Cote, President
Appropriate Solutions, Inc.
We Build Software

More information about the Twisted-web mailing list