Proxy cache for php site

lpugoy nginx-forum at nginx.us
Wed Nov 9 13:18:55 UTC 2011


lpugoy Wrote:
> Hello.
> 
> Thank you for the explanation. I now understand
> the problem and it is now working.
> 
> I want to add a condition where if a cookie with
> the name sess_id is included in the request, then
> the cache would be bypassed. I tried the following
> 
> 
> if ($http_cookie ~* "sess_id") {
>   set $no_cache "1";
> }
> 
> proxy_no_cache $no_cache;
> proxy_cache_bypass $no_cache;
> 
> but it doesn't seem to work. What is the correct
> way to do this? Thank you very much.

An update. I don't think that the if statement is being entered. There
are these messages in the debug log


2011/11/09 21:14:03 [debug] 6397#0: *3 http script var
2011/11/09 21:14:03 [debug] 6397#0: *3 http script regex: "sess_id"
2011/11/09 21:14:03 [notice] 6397#0: *3 "sess_id" does not match "",
client: 10.214.99.16, server: *.site.com, request: "GET / HTTP/1.1",
host: "www.site.com"
2011/11/09 21:14:03 [debug] 6397#0: *3 http script if
2011/11/09 21:14:03 [debug] 6397#0: *3 http script if: false

Is there another way I can test for existence of cookies?

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



More information about the nginx mailing list