Mercurial > hg > nginx-site
comparison xml/en/docs/http/ngx_http_upstream_module.xml @ 987:edd505634357
Documented the "sticky" directive.
author | Vladimir Homutov <vl@nginx.com> |
---|---|
date | Wed, 25 Sep 2013 16:54:48 +0400 |
parents | fc35441b4856 |
children | a060ab6fb4be |
comparison
equal
deleted
inserted
replaced
986:5e84ce26c7a7 | 987:edd505634357 |
---|---|
8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> | 8 <!DOCTYPE module SYSTEM "../../../../dtd/module.dtd"> |
9 | 9 |
10 <module name="Module ngx_http_upstream_module" | 10 <module name="Module ngx_http_upstream_module" |
11 link="/en/docs/http/ngx_http_upstream_module.html" | 11 link="/en/docs/http/ngx_http_upstream_module.html" |
12 lang="en" | 12 lang="en" |
13 rev="10"> | 13 rev="11"> |
14 | 14 |
15 <section id="summary"> | 15 <section id="summary"> |
16 | 16 |
17 <para> | 17 <para> |
18 The <literal>ngx_http_upstream_module</literal> module | 18 The <literal>ngx_http_upstream_module</literal> module |
201 <tag-desc> | 201 <tag-desc> |
202 marks the server as permanently unavailable; used along with | 202 marks the server as permanently unavailable; used along with |
203 the <link id="ip_hash"/> directive. | 203 the <link id="ip_hash"/> directive. |
204 </tag-desc> | 204 </tag-desc> |
205 | 205 |
206 <tag-name><literal>route</literal>=<value>string</value></tag-name> | |
207 <tag-desc> | |
208 sets the server route name. | |
209 <note> | |
210 This functionality is available as part of our <commercial_version/> only. | |
211 </note> | |
212 </tag-desc> | |
213 | |
206 </list> | 214 </list> |
207 </para> | 215 </para> |
208 | 216 |
209 <para> | 217 <para> |
210 Example: | 218 Example: |
691 </para> | 699 </para> |
692 | 700 |
693 </directive> | 701 </directive> |
694 | 702 |
695 | 703 |
704 <directive name="sticky"> | |
705 <syntax><literal>route</literal> <value>variable</value> ...</syntax> | |
706 <default/> | |
707 <context>upstream</context> | |
708 | |
709 <para> | |
710 Enables session affinity, which causes requests that contain route to the | |
711 server to be passed to this server in a group of servers. | |
712 Example: | |
713 <example> | |
714 map $cookie_JSESSIONID $route_cookie { | |
715 ~.+\.(?P<route>\w+)$ $route; | |
716 } | |
717 | |
718 map $request_uri $route_uri { | |
719 ~jsessionid=.+\.(?P<route>\w+)$ $route; | |
720 } | |
721 | |
722 upstream backend { | |
723 server backend1.example.com route=a; | |
724 server backend2.example.com route=b; | |
725 | |
726 sticky route $route_cookie $route_uri; | |
727 } | |
728 </example> | |
729 Here, the “<literal>JSESSIONID</literal>” cookie is inspected for a server | |
730 route first, and if not found, the route from the URI is used. | |
731 </para> | |
732 | |
733 <para> | |
734 A request that does not contain a server route is passed to the server | |
735 selected by the configured balancing method. | |
736 If a request cannot be processed by the bound server, the new server | |
737 is selected as if the client was not yet bound. | |
738 </para> | |
739 | |
740 <para> | |
741 The directive specifies variables that are examined for the route. | |
742 This route is compared with routes specified in the <link id="server"/> | |
743 directives. | |
744 The first non-empty variable is used for server search. | |
745 </para> | |
746 | |
747 <para> | |
748 <note> | |
749 This directive is available as part of our <commercial_version/> only. | |
750 </note> | |
751 </para> | |
752 | |
753 </directive> | |
754 | |
755 | |
696 <directive name="sticky_cookie_insert"> | 756 <directive name="sticky_cookie_insert"> |
697 <syntax><value>name</value> | 757 <syntax><value>name</value> |
698 [<literal>expires=</literal><value>time</value>] | 758 [<literal>expires=</literal><value>time</value>] |
699 [<literal>domain=</literal><value>host</value>] | 759 [<literal>domain=</literal><value>host</value>] |
700 [<literal>path=</literal><value>path</value>]</syntax> | 760 [<literal>path=</literal><value>path</value>]</syntax> |
888 | 948 |
889 <tag-name> | 949 <tag-name> |
890 <literal>up=</literal></tag-name> | 950 <literal>up=</literal></tag-name> |
891 <tag-desc> | 951 <tag-desc> |
892 The opposite of the “<literal>down</literal>” parameter | 952 The opposite of the “<literal>down</literal>” parameter |
953 of the <link id="server"/> directive. | |
954 </tag-desc> | |
955 | |
956 <tag-name> | |
957 <literal>route=</literal><value>string</value></tag-name> | |
958 <tag-desc> | |
959 Same as the “<literal>route</literal>” parameter | |
893 of the <link id="server"/> directive. | 960 of the <link id="server"/> directive. |
894 </tag-desc> | 961 </tag-desc> |
895 | 962 |
896 </list> | 963 </list> |
897 | 964 |