chore: Add Cache-Control header for static assets (#22175)

Fix https://github.com/appsmithorg/appsmith/issues/10503

Continuing discussion from
https://github.com/appsmithorg/appsmith/pull/21951.
This commit is contained in:
Shrikant Sharat Kandula 2023-04-19 06:42:01 +05:30 committed by GitHub
parent 9e3f70f894
commit 97a2338d4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -73,6 +73,11 @@ server {
try_files \$uri /index.html =404;
}
location ~ ^/static/(js|css|media)\b {
# Files in these folders are hashed, so we can set a long cache time.
add_header Cache-Control "max-age=31104000, immutable"; # 360 days
}
# If the path has an extension at the end, then respond with 404 status if the file not found.
location ~ ^/(?!supervisor/).*\.[a-z]+$ {
try_files \$uri =404;

View File

@ -90,6 +90,11 @@ server {
try_files \$uri /index.html =404;
}
location ~ ^/static/(js|css|media)\b {
# Files in these folders are hashed, so we can set a long cache time.
add_header Cache-Control "max-age=31104000, immutable"; # 360 days
}
# If the path has an extension at the end, then respond with 404 status if the file not found.
location ~ ^/(?!supervisor/).*\.[a-z]+$ {
try_files \$uri =404;