Forum: NGINX Sending location headers from a fastcgi application

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
5ada1800aed8e23b28de817fe9394e31?d=identicon&s=25 Spil Games (spilgames)
on 2008-10-15 13:58
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#s...


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)?
A8108a0961c6087c43cda32c8616dcba?d=identicon&s=25 Maxim Dounin (Guest)
on 2008-10-15 14:31
(Received via mailing list)
Hello!

On Wed, Oct 15, 2008 at 01:58:15PM +0200, Spil Games 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 Dounin
5ada1800aed8e23b28de817fe9394e31?d=identicon&s=25 Spil Games (spilgames)
on 2008-10-15 16:24
Attachment: nginx-0.6.32-fastcgi_location.patch (866 Bytes)
Maxim Dounin wrote:
> This was fixed in 0.7.8.

Thanks for the pointer. The attached patch should fix this for 0.6.32.
5ada1800aed8e23b28de817fe9394e31?d=identicon&s=25 Spil Games (spilgames)
on 2008-10-16 08:57
Spil Games wrote:
> Thanks for the pointer. The attached patch should fix this for 0.6.32.

Upstream needed patching too. Attaching fixed patch.
This topic is locked and can not be replied to.