ST smntov at
Sat Jun 10 21:18:14 UTC 2017

Hi Francis,

On Sat, 2017-06-10 at 07:49 +0100, Francis Daly wrote:
> 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?

Thank you very much for the detailed answer. Now I understand what the
line meant. However I'm not sure it solves my problem. Actually I was
trying to translate following two lines from Apache config into nginx,
however it is probably not related to fastcgi_cache_key, as I have
initially assumed...

Here are the two lines:
RewriteRule .* - [E=HTTP_IF_MODIFIED_SINCE:%{HTTP:If-Modified-Since}]
RewriteRule .* - [E=HTTP_IF_NONE_MATCH:%{HTTP:If-None-Match}]

Do you know what is their equivalent in nginx?

Thank you in advance!

More information about the nginx mailing list