From ab4ce36c1a0d39b685ec2ee30e63a2eb7e752f54 Mon Sep 17 00:00:00 2001 From: Rainer Jung Date: Fri, 14 Dec 2012 13:29:31 +0000 Subject: Fix use of trailing slashes in proxy balancer and member URLs and add a little explanation. Current behavior AFAIK: - Any path of a balancer URL inside is ignored. So lets not use e.g.trailing slashes there. The URL should for consistency always look like balancer://mycluster. - The general comment about trailing slashes on the left and right of ProxyPass is also right for balancer use. - Trailing slahes in BalancerMember in most cases lead to double slashes on the origin server. So lets drop them there and instead get the ProxyPass to the balancer right. - Path components in member URLs are only needed, if different path prefixes are needed for members in the same balancer (unlikely but possible). If all members work with the same non-empty additional prefix, put it into the ProxyPass at the end of the balancer instead. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1421851 13f79535-47bb-0310-9956-ffa450edef68 --- docs/manual/mod/mod_proxy.xml | 25 +++++++++++++++---------- docs/manual/mod/mod_proxy_balancer.xml | 28 ++++++++++++++-------------- docs/manual/mod/mod_proxy_fcgi.xml | 4 ++-- docs/manual/mod/mod_proxy_scgi.xml | 6 +++--- 4 files changed, 34 insertions(+), 29 deletions(-) (limited to 'docs/manual') diff --git a/docs/manual/mod/mod_proxy.xml b/docs/manual/mod/mod_proxy.xml index 5c381fb087..8dd5e50dc6 100644 --- a/docs/manual/mod/mod_proxy.xml +++ b/docs/manual/mod/mod_proxy.xml @@ -684,6 +684,11 @@ expressions

The balancerurl is only needed when not in <Proxy balancer://...> container directive. It corresponds to the url of a balancer defined in ProxyPass directive.

+

The path component of the balancer URL in any + <Proxy balancer://...> container directive + is ignored.

+

Trailing slashes should typically be removed from the URL of a + BalancerMember.

@@ -707,8 +712,8 @@ expressions <Proxy balancer://hotcluster> - BalancerMember http://www2.example.com:8080/ loadfactor=1 - BalancerMember http://www3.example.com:8080/ loadfactor=2 + BalancerMember http://www2.example.com:8080 loadfactor=1 + BalancerMember http://www3.example.com:8080 loadfactor=2 ProxySet lbmethod=bytraffic </Proxy> @@ -1032,7 +1037,7 @@ ProxyPass /mirror/foo http://backend.example.com

If the Proxy directive scheme starts with the - balancer:// (eg: balancer://cluster/, + balancer:// (eg: balancer://cluster, any path information is ignored) then a virtual worker that does not really communicate with the backend server will be created. Instead it is responsible for the management of several "real" workers. In that case the special set of @@ -1129,22 +1134,22 @@ ProxyPass /mirror/foo http://backend.example.com ProxyPass /special-area http://special.example.com smax=5 max=10 ProxyPass / balancer://mycluster/ stickysession=JSESSIONID|jsessionid nofailover=On <Proxy balancer://mycluster> - BalancerMember ajp://1.2.3.4:8009/ - BalancerMember ajp://1.2.3.5:8009/ loadfactor=20 + BalancerMember ajp://1.2.3.4:8009 + BalancerMember ajp://1.2.3.5:8009 loadfactor=20 # Less powerful server, don't send as many requests there, - BalancerMember ajp://1.2.3.6:8009/ loadfactor=5 + BalancerMember ajp://1.2.3.6:8009 loadfactor=5 </Proxy>

Setting up a hot-standby, that will only be used if no other members are available

-ProxyPass / balancer://hotcluster/ +ProxyPass / balancer://hotcluster/ <Proxy balancer://hotcluster> - BalancerMember ajp://1.2.3.4:8009/ loadfactor=1 - BalancerMember ajp://1.2.3.5:8009/ loadfactor=2 + BalancerMember ajp://1.2.3.4:8009 loadfactor=1 + BalancerMember ajp://1.2.3.5:8009 loadfactor=2 # The server below is on hot standby - BalancerMember ajp://1.2.3.6:8009/ status=+H + BalancerMember ajp://1.2.3.6:8009 status=+H ProxySet lbmethod=bytraffic </Proxy> diff --git a/docs/manual/mod/mod_proxy_balancer.xml b/docs/manual/mod/mod_proxy_balancer.xml index 4ed81a0250..d7a3123e84 100644 --- a/docs/manual/mod/mod_proxy_balancer.xml +++ b/docs/manual/mod/mod_proxy_balancer.xml @@ -91,12 +91,12 @@

-<Proxy balancer://mycluster/> - BalancerMember http://192.168.1.50:80/ - BalancerMember http://192.168.1.51:80/ +<Proxy balancer://mycluster> + BalancerMember http://192.168.1.50:80 + BalancerMember http://192.168.1.51:80 </Proxy> -ProxyPass /test balancer://mycluster/ -ProxyPassReverse /test balancer://mycluster/ +ProxyPass /test balancer://mycluster +ProxyPassReverse /test balancer://mycluster

Another example of how to provide load balancing with stickyness @@ -106,13 +106,13 @@ ProxyPassReverse /test balancer://mycluster/ Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/" env=BALANCER_ROUTE_CHANGED -<Proxy balancer://mycluster/> - BalancerMember http://192.168.1.50:80/ route=1 - BalancerMember http://192.168.1.51:80/ route=2 +<Proxy balancer://mycluster> + BalancerMember http://192.168.1.50:80 route=1 + BalancerMember http://192.168.1.51:80 route=2 ProxySet stickysession=ROUTEID </Proxy> -ProxyPass /test balancer://mycluster/ -ProxyPassReverse /test balancer://mycluster/ +ProxyPass /test balancer://mycluster +ProxyPassReverse /test balancer://mycluster @@ -139,7 +139,7 @@ ProxyPassReverse /test balancer://mycluster/

BALANCER_NAME

This is assigned the name of the balancer used for the current - request. The value is something like balancer://foo/.

+ request. The value is something like balancer://foo.

@@ -248,10 +248,10 @@ ProxyPassReverse /test balancer://mycluster/ configuring the name of the cookie and the name of the URL parameter separated by a vertical bar (|) as in the following example:

-ProxyPass /test balancer://mycluster/ stickysession=JSESSIONID|jsessionid scolonpathdelim=On +ProxyPass /test balancer://mycluster stickysession=JSESSIONID|jsessionid scolonpathdelim=On <Proxy balancer://mycluster> - BalancerMember http://192.168.1.50:80/ route=node1 - BalancerMember http://192.168.1.51:80/ route=node2 + BalancerMember http://192.168.1.50:80 route=node1 + BalancerMember http://192.168.1.51:80 route=node2 </Proxy>

If the cookie and the request parameter both provide routing information diff --git a/docs/manual/mod/mod_proxy_fcgi.xml b/docs/manual/mod/mod_proxy_fcgi.xml index ca32557e8c..eb8771ab8c 100644 --- a/docs/manual/mod/mod_proxy_fcgi.xml +++ b/docs/manual/mod/mod_proxy_fcgi.xml @@ -93,8 +93,8 @@ ProxyPass /myapp/ balancer://myappcluster/ <Proxy balancer://myappcluster/> - BalancerMember fcgi://localhost:4000/ - BalancerMember fcgi://localhost:4001/ + BalancerMember fcgi://localhost:4000 + BalancerMember fcgi://localhost:4001 </Proxy> diff --git a/docs/manual/mod/mod_proxy_scgi.xml b/docs/manual/mod/mod_proxy_scgi.xml index a115a2190a..91942faa5b 100644 --- a/docs/manual/mod/mod_proxy_scgi.xml +++ b/docs/manual/mod/mod_proxy_scgi.xml @@ -68,9 +68,9 @@ Balanced gateway ProxyPass /scgi-bin/ balancer://somecluster/ -<Proxy balancer://somecluster/> - BalancerMember scgi://localhost:4000/ - BalancerMember scgi://localhost:4001/ +<Proxy balancer://somecluster> + BalancerMember scgi://localhost:4000 + BalancerMember scgi://localhost:4001 </Proxy> -- cgit v1.2.3