Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#579 closed defect (duplicate)

try_files and $fastcgi_path_info

Reported by: https://stackoverflow.com/users/573152/bernard-rosset Owned by:
Priority: major Milestone:
Component: nginx-core Version: 1.6.x
Keywords: Cc:
uname -a: Windows build 1.6.0 http://nginx.org/download/nginx-1.6.0.zip
nginx -V: nginx version: nginx/1.6.0
TLS SNI support enabled
configure arguments: --with-cc=cl --builddir=objs.msvc8 --with-debug --prefix= -
-conf-path=conf/nginx.conf --pid-path=logs/nginx.pid --http-log-path=logs/access
.log --error-log-path=logs/error.log --sbin-path=nginx.exe --http-client-body-te
mp-path=temp/client_body_temp --http-proxy-temp-path=temp/proxy_temp --http-fast
cgi-temp-path=temp/fastcgi_temp --http-scgi-temp-path=temp/scgi_temp --http-uwsg
i-temp-path=temp/uwsgi_temp --with-cc-opt=-DFD_SETSIZE=1024 --with-pcre=objs.msv
c8/lib/pcre-8.34 --with-zlib=objs.msvc8/lib/zlib-1.2.8 --with-select_module --wi
th-http_realip_module --with-http_addition_module --with-http_sub_module --with-
http_dav_module --with-http_stub_status_module --with-http_flv_module --with-htt
p_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-htt
p_auth_request_module --with-http_random_index_module --with-http_secure_link_mo
dule --with-mail --with-openssl=objs.msvc8/lib/openssl-1.0.1h --with-openssl-opt
=enable-tlsext --with-http_ssl_module --with-mail_ssl_module --with-ipv6

Description (last modified by Maxim Dounin)

Using the following configuration:

fastcgi_split_path_info ^(.+\.php)(/.*)$;
try_files $fastcgi_script_name =404;
fastcgi_pass   php:9000;
fastcgi_param SCRIPT_FILENAME  $document_root$fastcgi_script_name;
fastcgi_param PATH_INFO $fastcgi_path_info;
include        fastcgi_params;

with the following URI:
http://nginx/php.php/foo/bar

the following PHP $_SERVER variables are not set properly:

  • DOCUMENT_URI set to /php.php instead of /php.php/foo/bar
  • PATH_INFO set to empty instead of /foo/bar
  • PHP_SELF set to /php.php instead of /php.php/foo/bar

Removal of the try_files directive produces the expected variables assignement.

Note that the values being checked by try_files have no impact on the bug, ie using the following directive configuration

try_files $uri =404;

also triggers it

Change History (3)

comment:1 by https://stackoverflow.com/users/573152/bernard-rosset, 10 years ago

Mistake:
In the last note, if you use

try_files $uri =404;

with request URI http://nginx/php.php/foo/bar, you will most probably end up with a 404.
Rather use

try_files /php.php =404;

to test the non-dependency of the bug on try_files value

Last edited 10 years ago by https://stackoverflow.com/users/573152/bernard-rosset (previous) (diff)

comment:2 by Maxim Dounin, 10 years ago

Resolution: duplicate
Status: newclosed

Duplicate of ticket #321.

comment:3 by Maxim Dounin, 10 years ago

Description: modified (diff)
Version: 1.5.x1.6.x

Versions list updated, thanks for noting this.

Note: See TracTickets for help on using tickets.