Skipping the proxy cache based on a cookie?

Dayo nginx-forum at nginx.us
Wed Jan 19 22:58:21 MSK 2011


I think I am getting closer and hope someone can nudge me across the
line.

My set up is now ...

[code]
if ($http_cookie !~* "mycookie=0") {
	add_header Cookie: "mycookie=1";
}
[/code]

The idea being that if mycookie is not 0 (which should cover it not
being set), it is set to 1.  I then added cookie_MYCOOKIE to the bypass
and no cache parameters so that if it is set to 1, they are triggered.

The backend sets mycookie to 0 if it is 1 so that on subsequent
requests, the resource is served from the cache.

However unfortunately, the "add_header Cookie: "mycookie=1";" line does
not seem to be called at all.

Thanks

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,161969,167669#msg-167669




More information about the nginx mailing list