Nginx 1.8.0 http_proxy cache issues

Hi,

I’m using nginx 1.8.0 on Ubuntu 14.04 LTS.

nginx -V

nginx version: nginx/1.8.0
built with OpenSSL 1.0.1f 6 Jan 2014
TLS SNI support enabled

configure arguments: --with-cc-opt=‘-g -O2 -fPIE -fstack-protector
–param=ssp-buffer-size=4 -Wformat -Werror=format-security
-D_FORTIFY_SOURCE=2 -mtune=corei7-avx -march=corei7’
–with-ld-opt=‘-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro
-Wl,-z,now
-mtune=corei7-avx -march=corei7’ --prefix=/usr/share/nginx
–conf-path=/etc/nginx/nginx.conf
–http-log-path=/var/log/nginx/access.log
–error-log-path=/var/log/nginx/error.log
–lock-path=/var/lock/nginx.lock
–pid-path=/run/nginx.pid
–http-client-body-temp-path=/var/lib/nginx/body
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi
–http-proxy-temp-path=/var/lib/nginx/proxy
–http-scgi-temp-path=/var/lib/nginx/scgi
–http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit
–with-file-aio --with-http_ssl_module --with-http_stub_status_module
–with-http_realip_module --with-http_auth_request_module
–with-http_addition_module --with-http_geoip_module
–with-http_gunzip_module --with-http_gzip_static_module
–with-http_image_filter_module --with-http_perl_module
–with-http_secure_link_module
–add-module=/opt/rebuildnginx/nginx-1.8.0/debian/modules/headers-more-nginx-module
–add-module=/opt/rebuildnginx/nginx-1.8.0/debian/modules/nginx-auth-pam
–add-module=/opt/rebuildnginx/nginx-1.8.0/debian/modules/nginx-cache-purge
–add-module=/opt/rebuildnginx/nginx-1.8.0/debian/modules/nginx-development-kit
–add-module=/opt/rebuildnginx/nginx-1.8.0/debian/modules/nginx-echo
–add-module=/opt/rebuildnginx/nginx-1.8.0/debian/modules/ngx-fancyindex
–add-module=/opt/rebuildnginx/nginx-1.8.0/debian/modules/nginx-lua
–add-module=/opt/rebuildnginx/nginx-1.8.0/debian/modules/nginx-upstream-fair
–add-module=/opt/rebuildnginx/nginx-1.8.0/debian/modules/set-misc-nginx-module

I have noticed that when I restart nginx (using restart or just simple
stop
and then start) the cache is not invalidated as it used to be.
After each restart I get HIT for all pages that were valid in cache
before
the restart.
Did anyone else noticed this behavior ? If yes, how did you fix it?

Posted at Nginx Forum:

Hello!

On Tue, Aug 18, 2015 at 07:17:41AM -0400, adrian.biris wrote:

[…]

I have noticed that when I restart nginx (using restart or just simple stop
and then start) the cache is not invalidated as it used to be.
After each restart I get HIT for all pages that were valid in cache before
the restart.
Did anyone else noticed this behavior ? If yes, how did you fix it?

Caches are not expected to be invalidated on restart (and they
never used to be). If you want nginx to avoid using previously
cached responses after a restart, you can remove the cache
directory.


Maxim D.
http://nginx.org/