Setting headers and cookies when proxying

Igor Sysoev is at
Sat Aug 16 09:13:16 MSD 2008

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;

Igor Sysoev

More information about the nginx mailing list