Welcome! Log In Create A New Profile

Advanced

try_files internal redirect stripping QUERY_STRING?

Jeff Waugh
November 12, 2009 10:36PM
Hi all,

Using a fairly bog-standard try_files -> php/fastcgi config here with nginx
0.8.22. Looks very much like this:

index index.php;

location / {
try_files $uri $uri/ /index.php;
}

location ~ \.php$ {
include fastcgi_params;
fastcgi_pass fcgi_php; # defined in an upstream
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

With http://example.com/?test=test the QUERY_STRING = 'test=test'.

With http://example.com/path/?test=test the QUERY_STRING = '', while the
REQUEST_URI is correct (ie. also contains the query string).

Looking at the debug log, I noticed that at one point, nginx seems to be
doing an internal redirect to "/index.php?" -> if that question mark means
the same thing as it does in a configured rewrite, try_files is stripping
the query string!

I suspect that /?test=test is working because $uri/ is tested with the
index, thus becoming /index.php?test=test.

Thoughts?

- Jeff

--
linux.conf.au 2010: Wellington, NZ http://www.lca2010.org.nz/

"Do you know what [television news ownership] means to me? It gives me
the political muscle I need." - Kerry Packer
Subject Author Posted

try_files internal redirect stripping QUERY_STRING?

Jeff Waugh November 12, 2009 10:36PM

Re: try_files internal redirect stripping QUERY_STRING?

edogawaconan November 12, 2009 11:02PM

Re: try_files internal redirect stripping QUERY_STRING?

Jeff Waugh November 12, 2009 11:40PM

Re: try_files internal redirect stripping QUERY_STRING?

edogawaconan November 13, 2009 12:22AM

Re: try_files internal redirect stripping QUERY_STRING?

Jeff Waugh November 13, 2009 01:36AM

Re: try_files internal redirect stripping QUERY_STRING?

edogawaconan November 13, 2009 05:38AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 280
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready