Mercurial > hg > nginx-site
changeset 914:474a21f26a2a
Documented location behavior with proxying directives.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Thu, 23 May 2013 16:14:36 +0400 |
parents | 9a65d437da42 |
children | 893d36b6d013 |
files | xml/en/docs/http/ngx_http_core_module.xml xml/ru/docs/http/ngx_http_core_module.xml |
diffstat | 2 files changed, 51 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_core_module.xml +++ b/xml/en/docs/http/ngx_http_core_module.xml @@ -10,7 +10,7 @@ <module name="Module ngx_http_core_module" link="/en/docs/http/ngx_http_core_module.html" lang="en" - rev="19"> + rev="20"> <section id="directives" name="Directives"> @@ -1479,6 +1479,31 @@ used for request redirection. They cannot be nested, and cannot contain nested locations. </para> +<para> +If a location is defined by a prefix string that ends with the slash character, +and requests are processed by one of +<link doc="ngx_http_proxy_module.xml" id="proxy_pass"/>, +<link doc="ngx_http_fastcgi_module.xml" id="fastcgi_pass"/>, +<link doc="ngx_http_scgi_module.xml" id="scgi_pass"/>, +<link doc="ngx_http_uwsgi_module.xml" id="uwsgi_pass"/>, or +<link doc="ngx_http_memcached_module.xml" id="memcached_pass"/>, +then in response to a request with URI equal to this string, +but without the trailing slash, +a permanent redirect with the code 301 will be returned to the requested URI +with the slash appended. +If this is undesired, an exact match of the URI and location could be +defined like this: +<example> +location /user/ { + proxy_pass http://user.example.com; +} + +location = /user { + proxy_pass http://login.example.com; +} +</example> +</para> + <!-- <migration from="Apache" directive="Location" /> -->
--- a/xml/ru/docs/http/ngx_http_core_module.xml +++ b/xml/ru/docs/http/ngx_http_core_module.xml @@ -10,7 +10,7 @@ <module name="Модуль ngx_http_core_module" link="/ru/docs/http/ngx_http_core_module.html" lang="ru" - rev="19"> + rev="20"> <section id="directives" name="Директивы"> @@ -1467,6 +1467,30 @@ location ~* \.(gif|jpg|jpeg)$ { вложенные location’ы. </para> +<para> +Если location задан префиксной строкой со слэшом в конце +и запросы обрабатываются при помощи +<link doc="ngx_http_proxy_module.xml" id="proxy_pass"/>, +<link doc="ngx_http_fastcgi_module.xml" id="fastcgi_pass"/>, +<link doc="ngx_http_scgi_module.xml" id="scgi_pass"/>, +<link doc="ngx_http_uwsgi_module.xml" id="uwsgi_pass"/> или +<link doc="ngx_http_memcached_module.xml" id="memcached_pass"/>, +а в ответ на запрос с URI равным этой строке, но без завершающего слэша, +будет возвращено постоянное перенаправление с кодом 301 +на URI с добавленным в конец слэшом. +Если такое поведение нежелательно, можно задать точное совпадение +URI и location, например: +<example> +location /user/ { + proxy_pass http://user.example.com; +} + +location = /user { + proxy_pass http://login.example.com; +} +</example> +</para> + <!-- <migration from="Apache" directive="Location" /> -->