filter out headers for fastcgi cache

Michael McCallister mikemc-nginx at
Tue Feb 14 18:46:24 UTC 2012

Max wrote, On 02/10/2012 03:54 PM:
> The proxy_hide_header directive does exactly what you described,
> the cookies get stored in the cache, but they are not passed back
> to the client, so this is all you'd need:
> # Cache responses containing the Set-Cookie header as well
> fastcgi_ignore_headers Set-Cookie;
> # Strip the Set-Cookie header from cached content
> # when passing cached content back to clients
> proxy_hide_header Set-Cookie;
> You could also include session cookies in the fastcgi_cache_key
> to make sure new users get the default cached content, while
> everyone else gets their session-specific cached content:
> fastcgi_cache_key "$cookie_PHPSESSID$scheme$request_method$host$server_port$request_uri";
> Max

Thanks Max!

More information about the nginx mailing list