Published December 30th, 2005

So, the Ruby on Rails people are getting excited about Apache HTTPD getting native FastCGI support.

To prove that modproxyfcgi isn’t vaporware, I present a live/running demo.

And here is how its configured:

ProxyPass /fcgi-test fcgi-tcp://

And here is the source code:

import cgi
import types

def myapp(environ, start_response):
    start_response('200 OK', [('Content-Type', 'text/html')])
    out = ""
    # Print all environment variables
    out = out+"<h3>mod_proxy_fcgi test page</h3>"
    out = out+"<dl>"
    env_keys = environ.keys()
    for e in env_keys:
        if (type(environ[e]) == types.StringType):
          out = out+"<dt>"+cgi.escape(e+'='+'"'+environ[e]+'"') + "</dt>"
    out = out+"</dl>"
    return out

if __name__ == '__main__':
    from flup.server.fcgi import WSGIServer
#    from flup.server.ajp import WSGIServer
    WSGIServer(myapp, bindAddress=("",9500)).run() 

Most of the credit really should go to Garrett. He has been writing most of the actual code. I have just been watching the Firefly DVDs and inserting sneer comments about how XYZ patch doesn’t work with XYZ library.

Finally, A shout out to the Flup library for python. It supports AJP, FastCGI and SCGI, making it much easier to move applications between all the available connector protocols.

**Update: **Okay, like any new code there are bugs. The test page isn’t working right now… Oh well.

Written by Paul Querna, CTO @ ScaleFT. @pquerna