Sending location headers from a fastcgi application

Spil Games lists at ruby-forum.com
Wed Oct 15 15:58:15 MSD 2008


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)?
-- 
Posted via http://www.ruby-forum.com/.





More information about the nginx mailing list