I have been recently working on features in FeedLounge where we want to present a pretty URI to our users, so I decided to pull in mod_rewrite into the lighttpd mix.
No matter what I tried, I couldn’t get the rewritten URI passed down to the FastCGI processes. According to the lighttpd documentation, you only need to order the directives, and everything ‘just works’. I enabled request handling debugging, and I could see the URI being rewritten, but then be passed to FastCGI as the untouched URL.
I tried older versions of lighttpd, just to see if it was a bug, same problem. I then jumped on the lighttpd IRC channel, and was told that the rewritten URI is passed to the FastCGI process as the variable REDIRECT_URI. Brilliant. I read the FastCGI spec again, and could not find anything related to this, so I ended hacking up my request class something along these lines:
req.uri = env.get('REDIRECT_URI', 'BLANK')
if req.uri == 'BLANK':
req.uri = env.get('REQUEST_URI', '')
Not the best solution, but it does get the right URI passed into the python processes to get the work done.
I should note a couple of things:
- I am much more comfortable with Apache
- I did get a response from the lighttpd community in the same time I would have got a response about a similar issue with Apache
Popularity: 81%