﻿id	summary	reporter	owner	description	type	status	priority	milestone	component	version	resolution	keywords	cc	uname	nginx_version
784	Странное поведение внутренних переменных	mdpuma@…		"Здравствуйте,

Столкнулся с очень странным поведением nginx-a.

Суть такова. Делаю запрос через curl такого вида

curl 'https://www.dezmembrariauto.md/ru/auto-dealer-default-page/images/6674/expisnew/index.php?option=com_socialads&task=checkifadsavailable' -H 'Accept: text/html, */*; q=0.01' -H 'Accept-Encoding: gzip, deflate' -H 'Accept-Language: en-US,en;q=0.5' -H 'Content-Type: application/x-www-form-urlencoded; charset=UTF-8' -H 'Cookie: 114912b8dbc5730d7ad8d754e2078541=ru-RU; 58683124b2ed7032f323b0731724a131=7l234m855895sthlelm35sm7n4' -H 'Host: www.dezmembrariauto.md' -H 'Referer: https://www.dezmembrariauto.md/ru/auto-dealer-default-page/images/6674/expisnew/1.html' -H 'User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:40.0) Gecko/20100101 Firefox/40.0' -H 'X-Requested-With: XMLHttpRequest' --data $'ad_id=3&zone_id=2&module_id=\'427\'' --insecure

Коротко, POST запрос на страницу https://www.dezmembrariauto.md/index.php?option=com_socialads&task=checkifadsavailable
В логах получаю ответ что это POST запрос, но на php-fpm отправляется не то что ожидаю увидеть.

Добавил в location который обрабатывает данный запрос такие директивы
location @joomla {
        add_header LOCAT ""joomla"" always;
        fastcgi_pass unix:/home/admin/php-fpm.sock;
        fastcgi_index index.php;
        include /etc/nginx/fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root/index.php;
        fastcgi_param SCRIPT_NAME /index.php;
add_header  ARGS ""$args"" always;
add_header  REQUEST ""$request"" always;
add_header  QUERY_STRING      ""$query_string"" always;
add_header  REQUEST_METHOD    ""$request_method"" always;
add_header  CONTENT_TYPE      ""$content_type"" always;
add_header  CONTENT_LENGTH    ""$content_length"" always;

add_header  SCRIPT_NAME       ""$fastcgi_script_name"" always;
add_header  SCRIPT_FILENAME   ""$document_root$fastcgi_script_name"" always;
add_header  REQUEST_URI       ""$request_uri"" always;
add_header  DOCUMENT_URI      ""$document_uri"" always;
add_header  DOCUMENT_ROOT     ""$document_root"" always;
add_header  SERVER_PROTOCOL   ""$server_protocol"" always;
add_header  HTTPS             ""$https"" always;
}

В ответ получаю такие заголовки
< Server: nginx
< Date: Thu, 10 Sep 2015 07:36:29 GMT
< Content-Type: text/html; charset=utf-8
< Transfer-Encoding: chunked
< Connection: keep-alive
< Keep-Alive: timeout=60
< X-Powered-By: PHP/5.4.45
< P3P: CP=""NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM""
< Content-Encoding: gzip
< Expires: Mon, 1 Jan 2001 00:00:00 GMT
< Last-Modified: Thu, 10 Sep 2015 07:36:29 GMT
< Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
< Pragma: no-cache
< LOCAT: joomla
< REQUEST: POST /ru/auto-dealer-default-page/images/6674/expisnew/index.php?option=com_socialads&task=checkifadsavailable HTTP/1.1
< REQUEST_METHOD: GET
< CONTENT_TYPE: application/x-www-form-urlencoded; charset=UTF-8
< CONTENT_LENGTH: 33
< SCRIPT_NAME: /403_error.html
< SCRIPT_FILENAME: /home/admin/web/dezmembrariauto.md/public_html/403_error.html
< REQUEST_URI: /ru/auto-dealer-default-page/images/6674/expisnew/index.php?option=com_socialads&task=checkifadsavailable
< DOCUMENT_URI: /403_error.html
< DOCUMENT_ROOT: /home/admin/web/dezmembrariauto.md/public_html
< SERVER_PROTOCOL: HTTP/1.1
< HTTPS: on

Задаюсь вопросом, почему на php-fpm отправляется fastcgi_param REQUEST_METHOD равен GET а не POST

Также теряются аргументы $args/$query_string

Если из URI запроса просто убрать index.php то nginx ведёт себя правильно и агрументы не теряются."	defect	closed	major		nginx-core	1.8.x	invalid	request_method	admin@…	"# uname -a
Linux dezmembrariauto.md 2.6.32-34-pve #1 SMP Fri Dec 19 07:42:04 CET 2014 x86_64 x86_64 x86_64 GNU/Linux"	"# 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
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'"
