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?
Thanks very much.
Posted at Nginx Forum:
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 S.
Thanks. And I want to know the time when “proxy_set_header” is executed,
because the my cookie value is related to the chosen upstream server. So
will proxy_set_header happen before upstream peer initialization or
after that?
Posted at Nginx Forum:
On Fri, May 27, 2011 at 05:32:11AM -0400, speedfirst wrote:
Thanks. And I want to know the time when “proxy_set_header” is executed,
because the my cookie value is related to the chosen upstream server. So
will proxy_set_header happen before upstream peer initialization or
after that?
Before, and this value is used for all upstreams.
–
Igor S.