You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by nik600 <ni...@gmail.com> on 2014/05/21 21:21:25 UTC

[users@httpd] usage of querystring parameter instead of stickysession to route requests through proxy balancer

Dear all

i know that is possible to use a "route" parameter into the proxy balancer
definition and then set a stickysession cookie name into the ProxyPass
setting.

Example:

        ProxyPass / balancer://mycluster/ stickysession=MyCookie
        ProxyPassReverse / balancer://mycluster/

        <Proxy balancer://mycluster>
          BalancerMember http://x.y.z.t:80  route=node01
          BalancerMember http://x.y.z.u:80  route=node02
          ProxySet lbmethod=byrequests
        </Proxy>

If i set the cookie MyCookie=node01/02 i can route all requests to a
specific node, and that's ok.

But....due to some architecture and application limitation i'm not able to
operate with cookies, so i'm wondering if is possible to "detect" the route
parameter directly from a query string parameter.

Example:

http://foo/test.php (dst is decided by proxy balancer rules)
http://foo/test.php?MyRoute=node01 (dst is node01)
http://foo/test.php?MyRoute=node01 (dst is node02)

Thanks to all in advance, bye!

-- 
/*************/
nik600
http://www.kumbe.it

[users@httpd] Re: usage of querystring parameter instead of stickysession to route requests through proxy balancer

Posted by nik600 <ni...@gmail.com>.
Actually i've resolved using an explicit condition with mod_rewrite:

        <Directory /usr/share/php/imsl/com.imsl.mind.httpcluster/1.0>
                RewriteEngine on

                RewriteCond %{QUERY_STRING} ^(MyRoute=node1.*)
                RewriteRule (.*)
http://127.0.0.1:18002/%{REQUEST_URI} [P,L]

                RewriteCond %{QUERY_STRING} ^(MyRoute=node2.*)
                RewriteRule (.*)
http://127.0.0.2:18002/%{REQUEST_URI} [P,L]

                RewriteRule (.*)           balancer://mycluster/$1 [P,L]

        </Directory>

This configuration is working but is the "correct" one from your point of
view?

Thanks


2014-05-21 21:21 GMT+02:00 nik600 <ni...@gmail.com>:

> Dear all
>
> i know that is possible to use a "route" parameter into the proxy balancer
> definition and then set a stickysession cookie name into the ProxyPass
> setting.
>
> Example:
>
>         ProxyPass / balancer://mycluster/ stickysession=MyCookie
>         ProxyPassReverse / balancer://mycluster/
>
>         <Proxy balancer://mycluster>
>           BalancerMember http://x.y.z.t:80  route=node01
>           BalancerMember http://x.y.z.u:80  route=node02
>           ProxySet lbmethod=byrequests
>         </Proxy>
>
> If i set the cookie MyCookie=node01/02 i can route all requests to a
> specific node, and that's ok.
>
> But....due to some architecture and application limitation i'm not able to
> operate with cookies, so i'm wondering if is possible to "detect" the route
> parameter directly from a query string parameter.
>
> Example:
>
> http://foo/test.php (dst is decided by proxy balancer rules)
> http://foo/test.php?MyRoute=node01 (dst is node01)
> http://foo/test.php?MyRoute=node01 (dst is node02)
>
> Thanks to all in advance, bye!
>
> --
> /*************/
> nik600
> http://www.kumbe.it
>



-- 
/*************/
nik600
http://www.kumbe.it