move Cache-Control header to server block, making js location unnecessary
This commit is contained in:
parent
f15474e7c8
commit
25abb55cd0
1 changed files with 5 additions and 8 deletions
|
@ -5,6 +5,10 @@ server {
|
||||||
root /var/www;
|
root /var/www;
|
||||||
index index.php index.html index.htm;
|
index index.php index.html index.htm;
|
||||||
|
|
||||||
|
# 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";
|
||||||
add_header Cross-Origin-Embedder-Policy require-corp;
|
add_header Cross-Origin-Embedder-Policy require-corp;
|
||||||
add_header Cross-Origin-Resource-Policy same-origin;
|
add_header Cross-Origin-Resource-Policy same-origin;
|
||||||
add_header Cross-Origin-Opener-Policy same-origin;
|
add_header Cross-Origin-Opener-Policy same-origin;
|
||||||
|
@ -18,14 +22,6 @@ 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;
|
||||||
|
@ -33,6 +29,7 @@ server {
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
|
|
||||||
|
fastcgi_hide_header Cache-Control;
|
||||||
fastcgi_hide_header Cross-Origin-Embedder-Policy;
|
fastcgi_hide_header Cross-Origin-Embedder-Policy;
|
||||||
fastcgi_hide_header Cross-Origin-Resource-Policy;
|
fastcgi_hide_header Cross-Origin-Resource-Policy;
|
||||||
fastcgi_hide_header Cross-Origin-Opener-Policy;
|
fastcgi_hide_header Cross-Origin-Opener-Policy;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue