Skipping the proxy cache based on a cookie?

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


Dayo Wrote:
-------------------------------------------------------
> Hi all
> 
> I doesn't seem that "if ($cookie_COOKIE = "") {"
> is a valid test for the presence of a cookie as
> the code in the if statement does not seem to be
> run.
> 
> I am using ...
> 
> 
> if ($cookie_COOKIE = "") {
> add_header Set-Cookie: "hits = 1";
> }
> 
> 
> ... but no joy. (I tried the original suggestion
> first)
> 
> Open to further suggestions
> 
> Thanks

OK managed to find out that it should be along the lines of ...

[code]
if ($http_cookie ~* 'COOKIE = ""') {
[/code]

... but will not appreciate some advice on why my add header is not
working

Thanks

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




More information about the nginx mailing list