Mercurial > hg > nginx-site
changeset 1990:a108f1ff1690
Better documented proxy_pass with variables (ticket #803).
author | Ruslan Ermilov <ru@nginx.com> |
---|---|
date | Fri, 26 May 2017 18:58:02 +0300 |
parents | 7bf1a73248f5 |
children | 4f3dd2f548cf |
files | xml/en/docs/http/ngx_http_proxy_module.xml xml/ru/docs/http/ngx_http_proxy_module.xml |
diffstat | 2 files changed, 38 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/xml/en/docs/http/ngx_http_proxy_module.xml Fri May 26 18:58:01 2017 +0300 +++ b/xml/en/docs/http/ngx_http_proxy_module.xml Fri May 26 18:58:02 2017 +0300 @@ -10,7 +10,7 @@ <module name="Module ngx_http_proxy_module" link="/en/docs/http/ngx_http_proxy_module.html" lang="en" - rev="61"> + rev="62"> <section id="summary"> @@ -1377,6 +1377,14 @@ </para> <para> +Parameter value can contain variables. +In this case, if an address is specified as a domain name, +the name is searched among the described server groups, +and, if not found, is determined using a +<link doc="ngx_http_core_module.xml" id="resolver"/>. +</para> + +<para> A request URI is passed to the server as follows: <list type="bullet" compact="no"> @@ -1443,26 +1451,19 @@ the full changed request URI is passed to the server. </para> </listitem> -</list> -</para> -<para> -A server name, its port and the passed URI can also be specified using -variables: +<listitem> +When variables are used in <literal>proxy_pass</literal>: <example> -proxy_pass http://$host$uri; +location /name/ { + proxy_pass http://127.0.0.1$request_uri; +} </example> -or even like this: -<example> -proxy_pass $request; -</example> -</para> - -<para> -In this case, the server name is searched among the described -<link doc="ngx_http_upstream_module.xml">server groups</link>, -and, if not found, is determined using a -<link doc="ngx_http_core_module.xml" id="resolver"/>. +In this case, if URI is specified in the directive, +it is passed to the server as is, +replacing the original request URI. +</listitem> +</list> </para> <para>
--- a/xml/ru/docs/http/ngx_http_proxy_module.xml Fri May 26 18:58:01 2017 +0300 +++ b/xml/ru/docs/http/ngx_http_proxy_module.xml Fri May 26 18:58:02 2017 +0300 @@ -10,7 +10,7 @@ <module name="Модуль ngx_http_proxy_module" link="/ru/docs/http/ngx_http_proxy_module.html" lang="ru" - rev="61"> + rev="62"> <section id="summary"> @@ -1379,6 +1379,14 @@ </para> <para> +В значении параметра можно использовать переменные. +В этом случае, если адрес указан в виде доменного имени, +имя ищется среди описанных групп серверов +и если не найдено, то определяется с помощью +<link doc="ngx_http_core_module.xml" id="resolver"/>’а. +</para> + +<para> URI запроса передаётся на сервер так: <list type="bullet" compact="no"> @@ -1445,26 +1453,19 @@ передаётся изменённый URI запроса целиком. </para> </listitem> -</list> -</para> -<para> -Имя сервера, его порт и передаваемый URI можно также полностью задать -с помощью переменных: +<listitem> +При использовании переменных в <literal>proxy_pass</literal>: <example> -proxy_pass http://$host$uri; +location /name/ { + proxy_pass http://127.0.0.1$request_uri; +} </example> -или даже так: -<example> -proxy_pass $request; -</example> -</para> - -<para> -В этом случае имя сервера ищется среди описанных -<link doc="ngx_http_upstream_module.xml">групп серверов</link> -и если не найдено, то определяется с помощью -<link doc="ngx_http_core_module.xml" id="resolver"/>’а. +В этом случае если в директиве указан URI, +он передаётся на сервер как есть, +заменяя URI первоначального запроса. +</listitem> +</list> </para> <para>