How to add cookie when proxy_pass via programming?

Igor Sysoev igor at sysoev.ru
Fri May 27 12:00:55 MSD 2011


On Fri, May 27, 2011 at 12:49:30AM -0400, speedfirst wrote:
> Hey, I want to add custom cookie when proxy pass to the upstream in my
> custom module. I want to implement like what this config does:
> 
> proxy_pass http://servers;
> proxy_add_header Cookie "$http_cookie;KEY=VALUE";
> 
> But sinc the VALUE is dynamically generated so I need to add this cookie
> via programming.
> 
> How to do that?

Create a module that defines a veriable and use it in
proxy_set_header  Cookie  "$http_cookie; key=$var";


-- 
Igor Sysoev



More information about the nginx mailing list