Sending location headers from a fastcgi application

We’re trying to migrate some internal fastcgi application from Lighttpd
to Nginx. The problem is relatively easy: the application sends a
‘Location’ header without sending a ‘Status’ header. Nginx will return a
200 in this scenario where Lighttpd returns a 302.

Now I could add sending of the Status header to the application. Easy
enough, but the CGI 1.1 spec says otherwise:

The "Status" header field is used to indicate to the server
what status code the server MUST use in the response message.
It SHOULD NOT be sent if the script returns a "Location"
header field.

http://tools.ietf.org/html/draft-coar-cgi-v11-01#section-7.2.1.2

I checked PHP fastcgi and it sure as hell does send both headers at the
same time (not following CGI 1.1 specs).

Lighttpd is following CGI 1.1 specs through this small snippet of code:

/* CGI/1.1 rev 03 - 7.2.1.2 */
if ((con->parsed_response & HTTP_LOCATION) &&
    !(con->parsed_response & HTTP_STATUS)) {
    con->http_status = 302;
}

If Nginx claims to follow CGI 1.1 specifications (I’m not sure that it
does), shouldn’t it return a 302 response by itself when a Location
header is being send (just like Lighttpd)?

Hello!

On Wed, Oct 15, 2008 at 01:58:15PM +0200, Spil G. wrote:

We’re trying to migrate some internal fastcgi application from Lighttpd
to Nginx. The problem is relatively easy: the application sends a
‘Location’ header without sending a ‘Status’ header. Nginx will return a
200 in this scenario where Lighttpd returns a 302.

[…]

This was fixed in 0.7.8.

Maxim D.

Spil G. wrote:

Thanks for the pointer. The attached patch should fix this for 0.6.32.

Upstream needed patching too. Attaching fixed patch.

Maxim D. wrote:

This was fixed in 0.7.8.

Thanks for the pointer. The attached patch should fix this for 0.6.32.