Sunday
9
Apr 2006

Lighttpd, FastCGI, and mod_rewrite

(10:10 am) Tags: [Software, Projects, FeedLounge]

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:

Popularity: 34%

Comments: (4)
Monday
3
Apr 2006

FeedLounge reviewed

(1:28 pm) Tags: [FeedLounge]
Comments: (3)
Friday
31
Mar 2006

FeedLounge Release: SOG

(7:30 pm) Tags: [FeedLounge]
Comments: (2)
Saturday
18
Feb 2006

FeedLounge Review by Joe Shaw

(12:15 am) Tags: [FeedLounge]
Comments: Comments Off
Tuesday
10
Jan 2006

FeedLounge announces pricing

(12:27 am) Tags: [Projects, FeedLounge]
Comments: Comments Off
Sunday
8
Jan 2006

FeedValidator does the smart thing now

(10:26 am) Tags: [Software, FeedLounge]
Comments: Comments Off
Wednesday
28
Dec 2005

Gettin’ Twisted

(9:54 am) Tags: [Software, Projects, FeedLounge]
Comments: (5)
Monday
5
Dec 2005

Scalability is not the only concern

(8:13 pm) Tags: [Software, FeedLounge]
Comments: (7)

FeedLounge Beta Date Announced

(9:39 am) Tags: [FeedLounge]
Comments: Comments Off
Sunday
13
Nov 2005

No reading feeds for the feed reader developer

(9:30 am) Tags: [Life, FeedLounge]
Comments: (3)
Wednesday
12
Oct 2005

MySQL MyISAM vs InnoDB

(9:57 am) Tags: [Software, Rants, FeedLounge]
Comments: (5)
Tuesday
11
Oct 2005

The tale of two worlds - JavaScript OO performance in Firefox and IE

(8:58 am) Tags: [Software, Rants, Projects, FeedLounge]
Comments: (17)
Wednesday
7
Sep 2005

I am not a sysadmin, but I do play one on TV

(5:43 pm) Tags: [Sysadmin, Projects, FeedLounge]
Comments: (2)
Sunday
4
Sep 2005

Colo physical move complete

(10:06 pm) Tags: [Sysadmin, FeedLounge]
Comments: (3)
Friday
2
Sep 2005

FeedLounge Migration, part duex

(9:05 am) Tags: [Life, Sysadmin, Links, Projects, FeedLounge]
Comments: (2)
Saturday
6
Aug 2005

Heading back home

(8:24 am) Tags: [Life, FeedLounge]
Comments: (2)
Monday
13
Jun 2005

FeedLounge development: feed validation

(8:47 am) Tags: [Software, Why I like..., Projects, FeedLounge]
Comments: (3)
Saturday
11
Jun 2005

FeedLounge development: the parser

(3:41 pm) Tags: [Software, Why I like..., Projects, FeedLounge]
Comments: (3)
Friday
10
Jun 2005

Search Engine Fu

(5:53 pm) Tags: [FeedLounge]
Comments: Comments Off
Thursday
9
Jun 2005

FeedLounge Alpha Announced

(7:14 am) Tags: [FeedLounge]
Comments: (11)