You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Niranjan Rao <nh...@gmail.com> on 2016/03/30 20:15:56 UTC
[users@httpd] Load balancing based on header value
Greetings,
My first post to this mailing list.
I have apache2 load balancing working perfectly based on session
affinity. Traffic does get directed properly to appropriate tomcat server.
We are trying to use same servers to serve some REST API calls. These
calls don't have a session, however tomcat honouring the request does
maintain some state and we would like to redirect the traffic to same
tomcat based on some header value.
Tried searching and reading documents from apache web site, but have not
figured it out yet.
Can I load balance based on header value? It seems to be doable, but
could not find any example or how-to.
Regards,
Niranjan
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Load balancing based on header value
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Niranjan,
On 3/30/16 3:02 PM, Niranjan Rao wrote:
> I am using AJP to connect to tomcat.
>
> Entry in the config file looks like
>
> <Proxy balancer://cluster> BalancerMember ajp://myserver:8009
> route=node2 ProxySet lbmethod=bytraffic ProxySet
> stickysession=JSESSIONID </Proxy>
>
> Hope this answers your question.
Okay, so you are using mod_proxy_ajp.
I'm not sure how to do it in mod_proxy_ajp, but mod_jk allows the
request to override the worker to be used. I believe if you set the
JK_WORKER_NAME environment variable (for mod_jk only) that worker name
will be used. You can use whatever means in httpd to set that variable
such as mod_rewrite, etc.
I would imagine that there is a similar facility in mod_proxy_ajp.
- -chris
> On 3/30/16 2:15 PM, Niranjan Rao wrote:
>>>> Greetings,
>>>>
>>>> My first post to this mailing list.
>>>>
>>>> I have apache2 load balancing working perfectly based on
>>>> session affinity. Traffic does get directed properly to
>>>> appropriate tomcat server.
>>>>
>>>> We are trying to use same servers to serve some REST API
>>>> calls. These calls don't have a session, however tomcat
>>>> honouring the request does maintain some state and we would
>>>> like to redirect the traffic to same tomcat based on some
>>>> header value.
>>>>
>>>> Tried searching and reading documents from apache web site,
>>>> but have not figured it out yet.
>>>>
>>>> Can I load balance based on header value? It seems to be
>>>> doable, but could not find any example or how-to.
> Which module are you using to proxy httpd -> Tomcat?
>
> -chris
>>
>> ---------------------------------------------------------------------
>>
>>
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>> For additional commands, e-mail: users-help@httpd.apache.org
>>
>
>
> ---------------------------------------------------------------------
>
>
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlb8LhYACgkQ9CaO5/Lv0PAA1ACcC9BuizMCiIORYNyCgeQ9Vt+5
CeMAn3qo01HeRt9VRbKBVy1QXZrEL6y/
=ffky
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Load balancing based on header value
Posted by Niranjan Rao <nh...@gmail.com>.
I am using AJP to connect to tomcat.
Entry in the config file looks like
<Proxy balancer://cluster>
BalancerMember ajp://myserver:8009 route=node2
ProxySet lbmethod=bytraffic
ProxySet stickysession=JSESSIONID
</Proxy>
Hope this answers your question.
Regards,
Niranjan
On 03/30/2016 11:50 AM, Christopher Schultz wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Niranjan,
>
> On 3/30/16 2:15 PM, Niranjan Rao wrote:
>> Greetings,
>>
>> My first post to this mailing list.
>>
>> I have apache2 load balancing working perfectly based on session
>> affinity. Traffic does get directed properly to appropriate tomcat
>> server.
>>
>> We are trying to use same servers to serve some REST API calls.
>> These calls don't have a session, however tomcat honouring the
>> request does maintain some state and we would like to redirect the
>> traffic to same tomcat based on some header value.
>>
>> Tried searching and reading documents from apache web site, but
>> have not figured it out yet.
>>
>> Can I load balance based on header value? It seems to be doable,
>> but could not find any example or how-to.
> Which module are you using to proxy httpd -> Tomcat?
>
> - -chris
> -----BEGIN PGP SIGNATURE-----
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iEYEARECAAYFAlb8H+0ACgkQ9CaO5/Lv0PC5EACgusxMWIhLosqqSi2GTgS/wCCE
> 1bgAnilhfPcRq1iZkLRibCHsKuZfkuFF
> =vb8S
> -----END PGP SIGNATURE-----
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org
Re: [users@httpd] Load balancing based on header value
Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Niranjan,
On 3/30/16 2:15 PM, Niranjan Rao wrote:
> Greetings,
>
> My first post to this mailing list.
>
> I have apache2 load balancing working perfectly based on session
> affinity. Traffic does get directed properly to appropriate tomcat
> server.
>
> We are trying to use same servers to serve some REST API calls.
> These calls don't have a session, however tomcat honouring the
> request does maintain some state and we would like to redirect the
> traffic to same tomcat based on some header value.
>
> Tried searching and reading documents from apache web site, but
> have not figured it out yet.
>
> Can I load balance based on header value? It seems to be doable,
> but could not find any example or how-to.
Which module are you using to proxy httpd -> Tomcat?
- -chris
-----BEGIN PGP SIGNATURE-----
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
iEYEARECAAYFAlb8H+0ACgkQ9CaO5/Lv0PC5EACgusxMWIhLosqqSi2GTgS/wCCE
1bgAnilhfPcRq1iZkLRibCHsKuZfkuFF
=vb8S
-----END PGP SIGNATURE-----
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org