December 22, 2016 08:24AM
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?
Subject Author Posted

Allow caching of *some* filetypes?

mevans336 December 22, 2016 08:24AM

Re: Allow caching of *some* filetypes?

mevans336 December 22, 2016 08:51AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 255
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready