Opened 11 years ago
Last modified 11 years ago
#752 accepted defect
try_files + subrequest + proxy-handler problem — at Initial Version
| Reported by: | openid.yandex.ru/emychlo | Owned by: | |
|---|---|---|---|
| Priority: | minor | Milestone: | |
| Component: | nginx-core | Version: | 1.7.x |
| Keywords: | try_files | Cc: | |
| uname -a: | Darwin myc.rutube.corp 14.3.0 Darwin Kernel Version 14.3.0: Mon Mar 23 11:59:05 PDT 2015; root:xnu-2782.20.48~5/RELEASE_X86_64 x86_64 | ||
| nginx -V: |
nginx version: nginx/1.7.12
built by clang 6.1.0 (clang-602.0.49) (based on LLVM 3.6.0svn) configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I /usr/local/include -g -DNGX_DEBUG_MALLOC -O0' --with-ld-opt='-L /usr/local/lib' --conf-path=/usr/local/etc/nginx/nginx.conf --sbin-path=/usr/local/sbin/nginx --pid-path=/tmp/nginx.pid --error-log-path=/tmp/nginx-error.log --with-http_addition_module --with-debug --http-client-body-temp-path=/tmp/nginx/client_body_temp --http-fastcgi-temp-path=/tmp/nginx/fastcgi_temp --http-proxy-temp-path=/tmp/nginx/proxy_temp --http-scgi-temp-path=/tmp/nginx/scgi_temp --http-uwsgi-temp-path=/tmp/nginx/uwsgi_temp --http-log-path=/tmp/nginx-access.log |
||
Description
При использовании subrequest в сочетании с try_files с proxy-хэндлером наблюдается неоднозначное поведение nginx.
server {
listen 8081;
default_type text/html;
location /uno { return 200 "uno "; }
location /duo { return 200 "duo "; }
location /tres { return 200 "tres "; }
}
server {
listen 8080;
location / {
root /tmp;
try_files /tres =404;
proxy_pass http://127.0.0.1:8081;
add_after_body /duo;
}
}
При наличии файла /tmp/tres, на запрос
nginx возвращает в теле "uno tres ", а не "uno duo " или "tres tres ".
Т.о. URI основного запроса без изменений передается бэкенду (proxy_pass без URI).
В подзапросе же URI заведомо изменён, и proxy_pass использует нормализованный URI запроса целиком, т.е. "/tres".
Note:
See TracTickets
for help on using tickets.
