Setting headers and cookies when proxying

Guy Naor guy at
Sat Aug 16 09:35:40 MSD 2008


That will set a header, but will not allow me to set a cookie. If I use:

set_proxy_header Cookie whatever=something;

It overwrites the cookies sent by the browser. Is there a way to add a 
cookie this way?



Igor Sysoev wrote:
> On Fri, Aug 15, 2008 at 06:22:45PM -0700, Guy Naor wrote:
>> I am trying to write a module that will insert a header into the request
>> that is sent to the upstream servers (mongrels). I can set headers based on
>> the code found in some other modules, but all set the header on the response
>> headers, not the headers proxied forward. I also would like to set a cookie
>> in the same form - add a cookie to the headers that will be passed to the
>> upstream servers.
>> Any ponters as to where to look for something like that? Or some other
>> information that could help?
>> This is to be used in a multi-server load-balancing situation that require
>> client stickiness. My plan is to release this code so others could use it
>> once it's stable.
> As it was already suggested, you do not need a module for this, you may
> use configuration:
>         proxy_set_header  header   value;

More information about the nginx mailing list