Opened 11 years ago
Closed 11 years ago
#473 closed defect (invalid)
proxy_cache_revalidate does not distinguish through the cache key
Reported by: | Juan Carlos Bauza | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | nginx-module | Version: | 1.3.x |
Keywords: | proxy_cache_revalidate | Cc: | |
uname -a: |
Linux WebCached 3.11.0-14-generic #21-Ubuntu SMP Tue Nov 12 17:04:55 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
Linux WebCached 3.11.0-14-generic #21-Ubuntu SMP Tue Nov 12 17:04:55 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux Linux WebCached 3.11.0-14-generic #21-Ubuntu SMP Tue Nov 12 17:04:55 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux |
||
nginx -V: |
nginx version: nginx/1.5.8
TLS SNI support enabled configure arguments: --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-log-path=/var/log/nginx/access.log --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --with-pcre-jit --with-debug --with-http_addition_module --with-http_dav_module --with-http_flv_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_mp4_module --with-http_perl_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_spdy_module --with-http_stub_status_module --with-http_ssl_module --with-http_sub_module --with-http_xslt_module --with-ipv6 --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.5.8/debian/modules/headers-more-nginx-module --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-cache-purge --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-dav-ext-module --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-development-kit --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.5.8/debian/modules/ngx-fancyindex --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-http-push --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-upload-progress --add-module=/build/buildd/nginx-1.5.8/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.5.8/debian/modules/ngx_http_substitutions_filter_module |
Description
I have setup my proxy cache to separate desktop and mobile clients via the user agent. Desktop clients get cached while mobile clients bypass the cache.
If I turn on proxy_cache_revalidate, once the proxy cache is stale if the first client to visit the page is a mobile client then the desktop cache will be overwritten by a mobile version of the site. This behavior does not take place when not using proxy_cache_revalidate.
I believe the correct behavior is for the revalidation to take into consideration the cache key and only there is a match use that.
Commenting out the proxy revalidation line results in normal behavior.
Change History (3)
comment:1 by , 11 years ago
comment:2 by , 11 years ago
Adding to the cache key an identifier for the user agent group worked. I still think if you bypass the cache it shouldn't revalidate. I am thinking in the case of a logged in user that bypasses the cache you wouldn't want their version of the page getting cached either.
comment:3 by , 11 years ago
Resolution: | → invalid |
---|---|
Status: | new → closed |
If you bypass the cache, the proxy_cache_revalidate doesn't do anything as effectively there is nothing to revalidate from nginx point of view - it was forbidden from checking what's in the cache. But the response can still be saved to the cache unless caching is disabled either by backend or via proxy_no_cache directive.
More information can be found here:
http://nginx.org/r/proxy_cache_bypass
http://nginx.org/r/proxy_no_cache
http://nginx.org/r/proxy_cache_revalidate
My bad, as I bypass for mobile the key does not have the user agent identifier. I am going to add it and see if that makes a difference. Regardless, if cache is bypassed I think it shouldn't revalidate cache in that scenario.