filter out headers for fastcgi cache

Max nginxyz at mail.ru
Wed Feb 15 00:56:38 UTC 2012


14 февраля 2012, 22:48 от Michael McCallister <mikemc-nginx at terabytemedia.com>:
> Max wrote, On 02/10/2012 03:54 PM:
> > http://wiki.nginx.org/NginxHttpProxyModule#proxy_hide_header
> >
> > 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!

You're welcome! Just run s/proxy_/fastcgi_/ on the above to get
the fastcgi directives. Those directives are the same in all of
the (fastcgi|proxy|scgi|uwsgi) modules:

(fastcgi|proxy|scgi|uwsgi)_ignore_headers
http://wiki.nginx.org/NginxHttpFcgiModule#fastcgi_ignore_headers

(fastcgi|proxy|scgi|uwsgi)_hide_header
http://wiki.nginx.org/NginxHttpFcgiModule#fastcgi_hide_header

Max


More information about the nginx mailing list