I have this in my nginx config:
nginx.conf, http section:
proxy_cache_path /var/tmp/nginx_cache levels=1:2 keys_zone=my_cache:10m max_size=10g inactive=600m use_temp_path=off;
proxy_buffering on;
Then in my site's config I have this section:
location ~* ^.+\.(?:css|cur|js|jpe?g|gif|htc|ico|png|html|xml|otf|ttf|eot|woff|svg)$ {
proxy_cache my_cache;
proxy_cache_revalidate on;
proxy_cache_min_uses 1;
proxy_pass http://my.backend;
add_header X-Cache-Status $upstream_cache_status;
}
Whenever I make a request NGINX responds with
X-Cache-Status: MISS
header. Example response:
HTTP/1.1 200 OK
Server: nginx/1.13.8
Date: Mon, 12 Feb 2018 08:32:47 GMT
Content-Type: application/javascript
Content-Length: 40802
Connection: keep-alive
Last-Modified: Sun, 11 Feb 2018 06:31:40 GMT
ETag: "9f62-564e9ea066b00"
Vary: Accept-Encoding
X-Cache-Status: MISS
Accept-Ranges: bytes
And the same request to my backend:
HTTP/1.1 200 OK
Date: Mon, 12 Feb 2018 08:22:32 GMT
Server: Apache/2.4.7 (Ubuntu)
Last-Modified: Sun, 11 Feb 2018 06:31:40 GMT
ETag: "9f62-564e9ea066b00"
Accept-Ranges: bytes
Content-Length: 4080
Vary: Accept-Encoding
Content-Type: application/javascript
What have I missed?