mirror of
https://github.com/discourse/discourse.git
synced 2025-02-16 18:24:52 -06:00
FEATURE: Add immutable cache for assets that do not update
This will eliminate revalidation of avatars, css, js and uploads on reloads on supporting browsers (at the moment firefox)
This commit is contained in:
parent
ea1007e954
commit
eee22bf037
@ -96,7 +96,7 @@ server {
|
||||
|
||||
location ~* assets/.*\.(eot|ttf|woff|woff2|ico)$ {
|
||||
expires 1y;
|
||||
add_header Cache-Control public;
|
||||
add_header Cache-Control public, immutable;
|
||||
add_header Access-Control-Allow-Origin *;
|
||||
}
|
||||
|
||||
@ -116,20 +116,20 @@ server {
|
||||
# asset pipeline enables this
|
||||
# brotli_static on;
|
||||
gzip_static on;
|
||||
add_header Cache-Control public;
|
||||
add_header Cache-Control public, immutable;
|
||||
# TODO I don't think this break is needed, it just breaks out of rewrite
|
||||
break;
|
||||
}
|
||||
|
||||
location ~ ^/plugins/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control public;
|
||||
add_header Cache-Control public, immutable;
|
||||
}
|
||||
|
||||
# cache emojis
|
||||
location ~ /_?emoji.*\.(png|gif|jpg|jpeg)$/ {
|
||||
expires 1y;
|
||||
add_header Cache-Control public;
|
||||
add_header Cache-Control public, immutable;
|
||||
}
|
||||
|
||||
location ~ ^/uploads/ {
|
||||
@ -146,7 +146,7 @@ server {
|
||||
proxy_set_header X-Sendfile-Type X-Accel-Redirect;
|
||||
proxy_set_header X-Accel-Mapping $public/=/downloads/;
|
||||
expires 1y;
|
||||
add_header Cache-Control public;
|
||||
add_header Cache-Control public, immutable;
|
||||
|
||||
## optional upload anti-hotlinking rules
|
||||
#valid_referers none blocked mysite.com *.mysite.com;
|
||||
|
Loading…
Reference in New Issue
Block a user