Welcome! Log In Create A New Profile

Advanced

Cache_key - Not recognizing cookie

Posted by Arke 
Cache_key - Not recognizing cookie
June 11, 2011 08:05PM
I am trying to properly configure nginx to cache a site and appear to be having problems with the name of my cookie...

location ~ .php$ {
......
fastcgi_cache php;
fastcgi_cache_key $request_uri$http_cookie;
........
}

The above works but is unique for every single page visitor....

location ~ .php$ {
......
fastcgi_cache php;
fastcgi_cache_key $request_uri$cookie_CakeCookie[User][id];
........
}

CakeCookie[User][id] is the name of the cookie the script i am using sets.

When i do the above it seems to ignore the cookie component completely and servers everyone the same page...

Questions:

1) is the above the proper way to do key? $cookie_CakeCookie[User][id]
2) is this a bug in nginx not taking the [ ] in the cookie name?
3) is [ ] in the cookie name not standard?

Any help would be much appreciated.

Thanks!
Chris
Re: Cache_key - Not recognizing cookie
December 19, 2011 10:08AM
Are you using google analytics? Check your cookies on each page load to see that they are the same.

$http_cookie$request_method$host$request_uri

is what I use. You can also try installing the echo module to try and debug the cookie output.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 130
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready