I am trying to force the cache of this type of files: css, woff, otf, js, jpg, jpeg, gif, png, ico, cur, gz, svg, svgz, mp3, mp4, ogg, ogv and files without extension.
I can cache some images and mp3 files, but the rest are always in a state: X-Cache MISS
proxy_cache_path /tmp/test keys_zone=test:10m loader_files=300 max_size=4g;
location ~* (^/.*(css|woff|otf|js|jpg|jpeg|gif|png|ico|cur|gz|svg|svgz|mp3|mp4|ogg|ogv)$|^/web/image.*) {
proxy_cache test;
proxy_cache_methods GET HEAD;
proxy_cache_lock on;
proxy_ignore_headers Set-Cookie;
proxy_ignore_headers X-Accel-Expires;
proxy_ignore_headers Expires;
proxy_ignore_headers Cache-Control;
add_header Pragma "public";
add_header Cache-Control "public";
add_header X-Cache $upstream_cache_status;
access_log off;
expires 12h;
proxy_pass http://test;
}
GET:
- Accept: text/css,/;q=0.1
- Accept-Encoding: gzip, deflate, br
- Accept-Language: es-ES,es;q=0.8,en-US;q=0.5,en;q=0.3
- Cache-Control: no-cache
- Connection: keep-alive
- DNT: 1
- Pragma: no-cache
Nginx:
- Cache-Control: max-age=43200
- Connection: keep-alive
- Content-Encoding: gzip
- Content-Type: text/css
- Date: Fri, 15 Dec 2017 10:20:22 GMT
- ETag: W/"XXXXXXXXXX"
- Expires: Fri, 15 Dec 2017 22:20:22 GMT
- Server: nginx
- Transfer-Encoding: chunked
- Vary: Accept-Encoding
- X-Cache-Status: MISS
- X-Content-Type-Options: nosniff
THX