Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_proxy_module.xml @ 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 | fc3ba2e76974 |
comparison
equal
deleted
inserted
replaced
1989:7bf1a73248f5 | 1990:a108f1ff1690 |
---|---|
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | 8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
9 | 9 |
10 <module name="Module ngx_http_proxy_module" | 10 <module name="Module ngx_http_proxy_module" |
11 link="/en/docs/http/ngx_http_proxy_module.html" | 11 link="/en/docs/http/ngx_http_proxy_module.html" |
12 lang="en" | 12 lang="en" |
13 rev="61"> | 13 rev="62"> |
14 | 14 |
15 <section id="summary"> | 15 <section id="summary"> |
16 | 16 |
17 <para> | 17 <para> |
18 The <literal>ngx_http_proxy_module</literal> module allows passing | 18 The <literal>ngx_http_proxy_module</literal> module allows passing |
1375 In addition, an address can be specified as a | 1375 In addition, an address can be specified as a |
1376 <link doc="ngx_http_upstream_module.xml">server group</link>. | 1376 <link doc="ngx_http_upstream_module.xml">server group</link>. |
1377 </para> | 1377 </para> |
1378 | 1378 |
1379 <para> | 1379 <para> |
1380 Parameter value can contain variables. | |
1381 In this case, if an address is specified as a domain name, | |
1382 the name is searched among the described server groups, | |
1383 and, if not found, is determined using a | |
1384 <link doc="ngx_http_core_module.xml" id="resolver"/>. | |
1385 </para> | |
1386 | |
1387 <para> | |
1380 A request URI is passed to the server as follows: | 1388 A request URI is passed to the server as follows: |
1381 <list type="bullet" compact="no"> | 1389 <list type="bullet" compact="no"> |
1382 | 1390 |
1383 <listitem> | 1391 <listitem> |
1384 If the <literal>proxy_pass</literal> directive is specified with a URI, | 1392 If the <literal>proxy_pass</literal> directive is specified with a URI, |
1441 <para> | 1449 <para> |
1442 In this case, the URI specified in the directive is ignored and | 1450 In this case, the URI specified in the directive is ignored and |
1443 the full changed request URI is passed to the server. | 1451 the full changed request URI is passed to the server. |
1444 </para> | 1452 </para> |
1445 </listitem> | 1453 </listitem> |
1454 | |
1455 <listitem> | |
1456 When variables are used in <literal>proxy_pass</literal>: | |
1457 <example> | |
1458 location /name/ { | |
1459 proxy_pass http://127.0.0.1$request_uri; | |
1460 } | |
1461 </example> | |
1462 In this case, if URI is specified in the directive, | |
1463 it is passed to the server as is, | |
1464 replacing the original request URI. | |
1465 </listitem> | |
1446 </list> | 1466 </list> |
1447 </para> | |
1448 | |
1449 <para> | |
1450 A server name, its port and the passed URI can also be specified using | |
1451 variables: | |
1452 <example> | |
1453 proxy_pass http://$host$uri; | |
1454 </example> | |
1455 or even like this: | |
1456 <example> | |
1457 proxy_pass $request; | |
1458 </example> | |
1459 </para> | |
1460 | |
1461 <para> | |
1462 In this case, the server name is searched among the described | |
1463 <link doc="ngx_http_upstream_module.xml">server groups</link>, | |
1464 and, if not found, is determined using a | |
1465 <link doc="ngx_http_core_module.xml" id="resolver"/>. | |
1466 </para> | 1467 </para> |
1467 | 1468 |
1468 <para> | 1469 <para> |
1469 <link doc="websocket.xml">WebSocket</link> proxying requires special | 1470 <link doc="websocket.xml">WebSocket</link> proxying requires special |
1470 configuration and is supported since version 1.3.13. | 1471 configuration and is supported since version 1.3.13. |