I ran into a set of problems recently with Lighttpd, which otherwise has been a marvellous piece of software.
I use Lighty as a load-balancing proxy front-end for a set of backend request-handling servers written in Python, using the Pylons framework. The connection between Lighty and the backends uses FastCGI.
Problem I had was that any request I made would generate a 301 redirect back to itself, with a ‘/’ appended to the URL. This was sent back by the browser, and a request storm ensued till Firefox aborted the request.
I asked Ian Bicking what could cause this on #pythonpaste. He suggested investigating PATH_INFO & SCRIPT_NAME parameters, which I did by writing a small test app using flup. This showed that PATH_INFO always was empty, whilst SCRIPT_NAME was set correctly.
Once I confirmed this, Ian suggested I use the Paste prefix middleware to fix up PATH_INFO. Whilst this problably would have solved my problem, I investigated further on the Lighty side and found that Jan Kneschke had resolved the issue in the 1.5 trunk of Lighty. A brief rebuild later (using cmake – scons and autoconf gave me grief); and a more protracted rewrite of Lighty’s config-file (as he at the same time refactored the code to combine mod_fastcgi & mod_proxy into a new module, mod_proxy_core) I now have a working FastCGI request-path into Pylons. Excellent!
PS. One nice feature in the new mod_proxy_core is that you can set the values of the parameters using regexes from the request URI, thus giving full control of the mapping of incoming request to backend SCRIPT_NAME/PATHINFO. Read the mod_proxy_core documentation and this post by Ian Bicking!
To build the 1.5 trunk version, use:
$ svn co svn://svn.lighttpd.net/lighttpd/trunk
$ cmake .
$ make
$ sudo make install
On Ubunty Feisty, you will need to install the following packages: build-essential, cmake, sendfile, libaio-dev, libpcre3-dev