Add Cache-Control header with no-transform directive
This should avoid that proxies like Cloudflare and others break SRI. Signed-off-by: Sylvain Rabot <sylvain@abstraction.fr>
This commit is contained in:
parent
607c4248b9
commit
90b0271bf2
1 changed files with 8 additions and 0 deletions
|
@ -18,6 +18,14 @@ server {
|
||||||
try_files $uri $uri/ /index.php$is_args$args;
|
try_files $uri $uri/ /index.php$is_args$args;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
location ~ \.js$ {
|
||||||
|
# no-transform tells Cloudflare and others to not change the content of
|
||||||
|
# the file and thus breaking SRI.
|
||||||
|
# https://developers.cloudflare.com/cache/about/cache-control#other
|
||||||
|
add header Cache-Control "public, max-age=3600, must-revalidate, no-transform";
|
||||||
|
try_files $uri $uri/ =404;
|
||||||
|
}
|
||||||
|
|
||||||
location ~ \.php$ {
|
location ~ \.php$ {
|
||||||
include /etc/nginx/location.d/*.conf;
|
include /etc/nginx/location.d/*.conf;
|
||||||
fastcgi_pass unix:/run/php-fpm.sock;
|
fastcgi_pass unix:/run/php-fpm.sock;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue