Debugging FastCGI caching

Daniel15 nginx-forum at
Mon Jan 28 06:28:36 UTC 2013

Francis Daly Wrote:
> $ curl -i -I
> HTTP/1.1 200 OK
> ....
> Cache-Control: private
> ....
> I don't see anything in your config which adds that header, so
> presumably it is coming from upstream.

Thanks, Mono / ASP.NET must be adding that by default (as I have not
explicitly added any caching headers). I'll set the correct caching headers
for this page.

Based on this, I assume that Nginx only caches responses with Cache-Control:
public (or similar) headers? I couldn't find this documented anywhere on the
Nginx site so I wasn't sure.

Does Nginx use the Expires or Max-Age headers, and how do these work with
fastcgi_cache_valid? If the Max-Age is 1 hour and Expires is 1 hour in the
future, but fastcgi_cache_valid is set to 2 hours, how long would Nginx
cache the response for?

Posted at Nginx Forum:,235609,235630#msg-235630

More information about the nginx mailing list