Proxy cache only is cookie present

nfn nginx-forum at
Wed Dec 2 21:29:36 MSK 2009


I've manage to insert a cookie named "guests=guests" in my app, because I have some doubts about the $cookie_COOKIE variable ... I don't know is matched the name or the value of the cookie.

In my tests, this is what I have:

        proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=members:10m inactive=5m max_size=500m;

        location /members/ {
            proxy_pass  http://apache;
            proxy_cache members;
            proxy_cache_key "$host$request_uri$cookie_guests";
            proxy_ignore_headers Cache-Control Expires;
            proxy_cache_valid 200 301 302 10m;
            proxy_pass_header Set-Cookie;

With this I can cache, but all others (registered) users will get the same cached page.

Need some help here :)

Posted at Nginx Forum:,26770,27483#msg-27483

More information about the nginx mailing list