Confusion about rewritten uri passed to a fastcgi program
Maxim Dounin
mdounin at mdounin.ru
Thu Jan 10 13:19:13 UTC 2019
Hello!
On Wed, Jan 09, 2019 at 03:05:22PM -0800, Mark Sellers wrote:
>
> My module (ngx_http_fastimg_module) rewrites the uri of an image request. If the image is not yet in the filesystem, then it (using try_files) calls a fastcgi (fastimg_fcgi) that creates the image, serves it, and saves it in the file system.
>
> I have noticed something that I don’t understand. When the fastcgi program is executed, it receives the original uri in the REQUEST_URI fastcgi param, and not the rewritten uri.
>
> I also notice that the rewritten uri is available in the DOCUMENT_URI fastcgi param.
>
> Is this what you would expect?
What is sent in FastCGI parameters is determined by the
fastcgi_param directives used in your configuration, see
http://nginx.org/r/fastcgi_param. The example/default
fastcgi_params file as shipped with nginx contains
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
so the REQUEST_URI param will get the original URI as sent by the
client, and the rewritten URI will be available in DOCUMENT_URI,
exactly as your observe.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx-devel
mailing list