For security purposes, we utilize the Cache-Control "no-cache, no-store, must-revalidate" add_header parameter in our root location block.
However, I'd like to tweak this to allow the following file types to be cached: jpg|jpeg|png|gif|ico|js|css|html
I added this above my root location / block, but it breaks all images and our css as well.
location ~* \.(jpg|jpeg|png|gif|ico|js|css|html)$ {
expires 7d;
}
Here is our root location block also:
location / {
add_header X-Frame-Options SAMEORIGIN;
add_header Strict-Transport-Security max-age=63072000;
add_header Cache-Control "no-cache, no-store, must-revalidate";
add_header Pragma "no-cache";
proxy_set_header Host $host;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_read_timeout 120s;
proxy_next_upstream error timeout invalid_header http_404 http_500;
proxy_intercept_errors on;
proxy_pass http://my_proxy;
}
Am I doing this correctly?