Multiple Cache Object for same file
Maxim Dounin
mdounin at mdounin.ru
Thu Jul 2 15:42:57 UTC 2020
Hello!
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
> /content/entry/jiomags/content/719/51/51_t_0.jpg
>
> 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
> ./2/95/9d78505da184e6ccd981fefe6b333952
> -rw------- 1 nginx nginx 21023 Jun 27 18:16
> ./f/ad/c8e1c56031a14dd4a27e538956253adf
>
> 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.
--
Maxim Dounin
http://mdounin.ru/
More information about the nginx
mailing list