The question is, for the first time visitor, the incoming request does
not have mycookie in the header, I can determine this and generate
cookie and Set-Cookie in response, however, I also need to change
incoming cookie header so that upstream (php-fpm now, but should be same
to all other upstreams as I’m guessing) can get this generated
“mycookie” as well.
I tried to add new entry to r->headers_in.cookies but it does not work,
also tried r->headers_in.headers but no luck either.
On Tue, Mar 19, 2013 at 11:50:43AM -0700, Cool wrote:
it seems fastcgi_param called before my filter so $cookie_note
always got empty, and
You shouldn’t rely on your filter already executed, and should
instead register a variable handler which does the actual work.
This way it will work at any time.
it seems fastcgi_param could not be used in a if directive so I
end up with change the cookie header even the mycookie is presented
in user’s request, thus
If there are conditions when you should not add a cookie I would
recommend you implementing a variable with full Cookie header you
want to pass, e.g.
fastcgi_param HTTP_COOKIE $my_new_cookie;
This way you may implement arbitrary conditions you want in your
module. (You may also construct the variable using if/set/map/etc, but
doing appropriate tests in your module would be less error prone.)