Multiple Cache Object for same file
mdounin at mdounin.ru
Thu Jul 2 15:42:57 UTC 2020
On Thu, Jul 02, 2020 at 05:06:17AM -0400, anish10dec wrote:
> We are observing that multiple cache object is getting created for same file
> in Nginx Cache which is resulting into non optimal use of cache storage.
> We are using proxy_cache_key as $uri.
> proxy_cache_key $uri;
> For example with file having URI
> 2 cache object has been created in cache folder. Both the files are having
> same KEY
> -rw------- 1 nginx nginx 21023 Jun 27 16:11
> -rw------- 1 nginx nginx 21023 Jun 27 18:16
> vi ./2/95/9d78505da184e6ccd981fefe6b333952
> Vary: Accept-Encoding^M
> What could be the reason for duplicate file getting cached having same URI
> and KEY.
> Please help
The reason is the "Vary: Accept-Encoding" header line returned by
your backend. If you want nginx to ignore it, consider using
"proxy_ignore_headers Vary;", see
http://nginx.org/r/proxy_ignore_headers for details.
More information about the nginx