Francis Daly francis at
Sat Jun 10 06:49:32 UTC 2017

On Fri, Jun 09, 2017 at 04:07:31PM +0300, ST wrote:

Hi there,

> I try to understand an example configuration and have difficulties with
> following line:
> fastcgi_cache_key "$request_method|$http_if_modified_since|
> $http_if_none_match|$host|$request_uri";
> Could somebody, please, explain what does it mean?

A cache key is the thing that nginx makes up out of the incoming request,
in order to check whether the response is already in the cache (so that
perhaps the response can be served from the cache instead of having to
go to the upstream server to fetch the response).

If you want one request to get the same cached response as another, they
must have the same value for the cache key. If you want one request not
to get the cached response from another, they should have different values
for the cache key (or some other cache-avoiding config must be used).

This particular directive sets the value for the cache key for requests
that might otherwise be handled by a fastcgi_pass directive. The cached
response will only be sent if these five values from the incoming request
are identical.

Does that answer the question?

Francis Daly        francis at

More information about the nginx mailing list