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:
parent
9e3f70f894
commit
97a2338d4b
|
|
@ -73,6 +73,11 @@ server {
|
||||||
try_files \$uri /index.html =404;
|
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.
|
# If the path has an extension at the end, then respond with 404 status if the file not found.
|
||||||
location ~ ^/(?!supervisor/).*\.[a-z]+$ {
|
location ~ ^/(?!supervisor/).*\.[a-z]+$ {
|
||||||
try_files \$uri =404;
|
try_files \$uri =404;
|
||||||
|
|
|
||||||
|
|
@ -90,6 +90,11 @@ server {
|
||||||
try_files \$uri /index.html =404;
|
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.
|
# If the path has an extension at the end, then respond with 404 status if the file not found.
|
||||||
location ~ ^/(?!supervisor/).*\.[a-z]+$ {
|
location ~ ^/(?!supervisor/).*\.[a-z]+$ {
|
||||||
try_files \$uri =404;
|
try_files \$uri =404;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user