try_files internal redirect stripping QUERY_STRING?

Edho P Arief edhoprima at gmail.com
Fri Nov 13 06:58:30 MSK 2009


On Fri, Nov 13, 2009 at 10:28 AM, Jeff Waugh <jdub at bethesignal.org> wrote:
> 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
>
>

I believe you can still get it with $_GET['var'] variable

-- 
O< ascii ribbon campaign - stop html mail - www.asciiribbon.org





More information about the nginx mailing list