Nginx_cache entry evicted ~ 10 min after write despite Cache-Control in the future

Using nginx 1.2.7

Trying to figure out what and why is removing cache entries about 10 min
after insert (or last read - not yet sure) when the Cache-Control +
Last-Modified is nearly 24 hours in the future. Are my config / response
headers to blame or something else?

Ex I would expect the following entry to remain until 22:24:45 Apr 10,
2015

  • yet it disappears from nginx cache dir about 10 min into existence -
    i.e.
    at around 22:35 Apr 9:

[clabs@lb1 cache]$ head 5c395f3ff23eaa0fae58000e5cdbb30a
8Pyote/1-?&U?@<
KEY: /ge/ge.js
HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Last-Modified: Thu, 09 Apr 2015 22:24:45 GMT
Cache-Control: max-age=86400, public
Content-Type: text/javascript;charset=UTF-8
Content-Language: en-US
Content-Length: 153734
Date: Thu, 09 Apr 2015 22:24:45 GMT

…and config:

proxy_cache_path /opt/clabs/nginx/tmp/cache keys_zone=static:1000m;
server {
server_name OMITTED;
listen 80;

      proxy_cache static;
      proxy_cache_key "$uri";

      location / {
        proxy_pass http://search-cluster;
        add_header "X-ECR-Nginx-Cache" $upstream_cache_status;
        add_header "X-ECR-Domain" "static";
      }
    }

thanks
-nikita

Posted at Nginx Forum:

On Thu, Apr 09, 2015 at 06:33:12PM -0400, nikita.tovstoles wrote:

Hi there,

Trying to figure out what and why is removing cache entries about 10 min
after insert (or last read - not yet sure) when the Cache-Control +
Last-Modified is nearly 24 hours in the future. Are my config / response
headers to blame or something else?

http://nginx.org/r/proxy_cache_path

proxy_cache_path /opt/clabs/nginx/tmp/cache keys_zone=static:1000m;

Look for “inactive”.

(That’s my guess, at any rate.)

f

Francis D. [email protected]

Replying own question - looks like proxy_cache_path’s inactive param is
to
blame - it defaults to 10 min per docs. Can I disable this param (by
setting
inactive=0?) to rely solely on HTTP Response headers?

Posted at Nginx Forum: