You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@trafficserver.apache.org by Alex Sviridov <oo...@mail.ru> on 2016/07/13 09:37:33 UTC

Mapping rule based on cookie

 Hello.

I need a reverse proxy which makes server mapping according to some value in cookie. 

For example, if there is a variable "key" and it is equal to 2 (key=2) then request must be redirected
to server 100.100.100.100. 

Can apache traffic server do that?

-- 
Alex Sviridov

Re: Mapping rule based on cookie

Posted by Miles Libbey <ml...@apache.org>.
Think one way to do this would be:
- use the header_rewrite plugin to check the cookie value and set the
destination/origin Host. Not sure about the whole IP thing... perhaps
make up a domain and set /etc/hosts to 100.100...? Or just set the
Host to 100.100..?
- use the cachekey plugin to put the cookie value in the cachekey.

something like:
map http://inbound.example.com http://origin.example.com \
  @plugin=cachekey.so @pparam=--include-cookies=cookienamehere
  @plugin=header_rewrite.so @pparam=header_rewrite.config


with header_rewrite.config containing:
cond %{COOKIE:cookienamehere} ="key=2"
   set-destination HOST 100.100.100.100

On Wed, Jul 13, 2016 at 3:16 AM, Reindl Harald <h....@thelounge.net> wrote:
>
>
> Am 13.07.2016 um 11:37 schrieb Alex Sviridov:
>>
>> I need a reverse proxy which makes server mapping according to some
>> value in cookie.
>>
>> For example, if there is a variable "key" and it is equal to 2 (key=2)
>> then request must be redirected
>> to server 100.100.100.100.
>>
>> Can apache traffic server do that?
>
>
> not that i know but i am pretty sure you should start to describe your
> probklem and waht you try to achieve instead ask for a specific solution
>
> in case of load-balancing the servers should use a shared session storage so
> that it don't matter on which backend machine a request ends
>

Re: Mapping rule based on cookie

Posted by Reindl Harald <h....@thelounge.net>.

Am 13.07.2016 um 11:37 schrieb Alex Sviridov:
> I need a reverse proxy which makes server mapping according to some
> value in cookie.
>
> For example, if there is a variable "key" and it is equal to 2 (key=2)
> then request must be redirected
> to server 100.100.100.100.
>
> Can apache traffic server do that?

not that i know but i am pretty sure you should start to describe your 
probklem and waht you try to achieve instead ask for a specific solution

in case of load-balancing the servers should use a shared session 
storage so that it don't matter on which backend machine a request ends