Opened 9 years ago

Closed 9 years ago

#758 closed defect (invalid)

Nginx in FastCGI mode always returns 302 http code if location header is set

Reported by: Alex Samorukov Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.7.x
Keywords: Cc:
uname -a: Linux ip-172-31-11-52 3.14.35-28.38.amzn1.x86_64 #1 SMP Wed Mar 11 22:50:37 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
nginx -V: [root@ip-172-31-11-52 magento]# nginx -V
nginx version: nginx/1.8.0
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-3) (GCC)
built with OpenSSL 1.0.1e-fips 11 Feb 2013 (running with OpenSSL 1.0.1k-fips 8 Jan 2015)
TLS SNI support enabled
configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-http_ssl_module --with-http_realip_module --with-http_addition_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-mail --with-mail_ssl_module --with-file-aio --with-ipv6 --with-http_spdy_module --with-cc-opt='-O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic'

Description

After migration from Apache to Nginx i found that one of my API client apps is not working correctly. After all reason was found - if there is a Location: header in fastcgi response - Nginx always sets response code 302. This behaviour is not respecting HTTP standard where no such limitations are set and also cases with non 3xx responses are mentioned:

14.30 Location

The Location response-header field is used to redirect the recipient to a location other than the Request-URI for completion of the request or identification of a new resource. For 201 (Created) responses, the Location is that of the new resource which was created by the request. For 3xx responses, the location SHOULD indicate the server's preferred URI for automatic redirection to the resource. The field value consists of a single absolute URI.

       Location       = "Location" ":" absoluteURI
An example is:

       Location: http://www.w3.org/pub/WWW/People.html
      Note: The Content-Location header field (section 14.14) differs
      from Location in that the Content-Location identifies the original
      location of the entity enclosed in the request. It is therefore
      possible for a response to contain header fields for both Location
      and Content-Location. Also see section 13.10 for cache
      requirements of some methods.

Is it possible to disable such "fix" or at least make this configurable?

Change History (2)

comment:1 by Alex Samorukov, 9 years ago

please close this ticker - problem is on php-fpm side. sorry for this noise.

comment:2 by Maxim Dounin, 9 years ago

Resolution: invalid
Status: newclosed
Note: See TracTickets for help on using tickets.