prevent caching of index.html, add cache-control header for other requests as well (#3992)

This commit is contained in:
Christoph Stenglein 2023-07-08 14:52:49 +02:00 committed by GitHub
parent 8d72c83ca9
commit 6965b6ceae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 2 deletions

View File

@ -32,6 +32,13 @@ server {
root /var/www/letsencrypt;
}
location = /index.html {
# internal means that it can't be called from outside
internal;
# add no-store to prevent caching of index.html
add_header Cache-Control 'no-store';
}
location / {
# make sure to have https link to exact same host that was called
sub_filter '<a href="https://HOST_SET_BY_NGINX/' '<a href="https://$host/';
@ -39,7 +46,7 @@ server {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html =404;
add_header Cache-Control "no-cache, must-revalidate";
}
}

View File

@ -23,6 +23,13 @@ server {
root /var/www/letsencrypt;
}
location = /index.html {
# internal means that it can't be called from outside
internal;
# add no-store to prevent caching of index.html
add_header Cache-Control 'no-store';
}
location / {
# make sure to have https link to exact same host that was called
sub_filter '<a href="https://HOST_SET_BY_NGINX/' '<a href="https://$host/';
@ -30,7 +37,7 @@ server {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ /index.html =404;
add_header Cache-Control "no-cache, must-revalidate";
}
}