proxy_pass to different upstreams based on a cookie in the http request header

Kunal Pariani kunalvjti at gmail.com
Thu Jun 12 07:00:47 UTC 2014


Thanks for your answer. Worked great for me..


On Wed, Jun 11, 2014 at 10:10 AM, Francis Daly <francis at daoine.org> wrote:

> On Wed, Jun 11, 2014 at 12:46:41AM -0700, Kunal Pariani wrote:
>
> Hi there,
>
> > Am wondering if there is a way to proxy (i.e proxy_pass inside location
> > directive) to different set of upstreams based on whether a particular
> > cookie is present or not in a http request header.
>
> You can use a map (http://nginx.org/r/map)
> to set a variable based on a cookie
> (http://nginx.org/en/docs/http/ngx_http_core_module.html#variables),
> and you can use a variable in your proxy_pass directive
> (http://nginx.org/r/proxy_pass).
>
> So it looks like it should Just Work.
>
>         f
> --
> Francis Daly        francis at daoine.org
>
> _______________________________________________
> nginx mailing list
> nginx at nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx/attachments/20140612/6932d060/attachment.html>


More information about the nginx mailing list