chore: prevent caching of JavaScript and HTML files in nginx configuration
This commit is contained in:
parent
7a5a6c6177
commit
7ea49a1c9e
1 changed files with 15 additions and 1 deletions
16
nginx.conf
16
nginx.conf
|
|
@ -9,13 +9,27 @@ server {
|
||||||
try_files $uri $uri/ =404;
|
try_files $uri $uri/ =404;
|
||||||
}
|
}
|
||||||
|
|
||||||
# Prevent caching of version.json
|
# Prevent caching of JavaScript files and version.json
|
||||||
|
location ~* \.(js|mjs)$ {
|
||||||
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
|
add_header Pragma "no-cache";
|
||||||
|
add_header Expires "0";
|
||||||
|
add_header Vary "Accept-Encoding";
|
||||||
|
}
|
||||||
|
|
||||||
location = /version.json {
|
location = /version.json {
|
||||||
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
add_header Pragma "no-cache";
|
add_header Pragma "no-cache";
|
||||||
add_header Expires "0";
|
add_header Expires "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Prevent caching of HTML
|
||||||
|
location ~* \.html$ {
|
||||||
|
add_header Cache-Control "no-cache, no-store, must-revalidate";
|
||||||
|
add_header Pragma "no-cache";
|
||||||
|
add_header Expires "0";
|
||||||
|
}
|
||||||
|
|
||||||
# Enable gzip compression
|
# Enable gzip compression
|
||||||
gzip on;
|
gzip on;
|
||||||
gzip_types text/html text/css application/javascript;
|
gzip_types text/html text/css application/javascript;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue