Skip to content

Commit b3d31e7

Browse files
Merge remote-tracking branch '39484/add-immutable' into julprs
2 parents 2ba60df + 70785e2 commit b3d31e7

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

nginx.conf.sample

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
##
2525
## fastcgi_param MAGE_MODE $MAGE_MODE;
2626
##
27-
## In production mode, you should uncomment the 'expires' directive in the /static/ location block
27+
## In production mode, you should uncomment the 'add_header Cache-Control "public, max-age=31536000, immutable"' directive in the /static/ location block
2828

2929
# Modules can be loaded only at the very beginning of the Nginx config file, please move the line below to the main config file
3030
# load_module /etc/nginx/modules/ngx_http_image_filter_module.so;
@@ -110,17 +110,16 @@ location /pub/ {
110110

111111
location /static/ {
112112
# Uncomment the following line in production mode
113-
# expires max;
113+
# add_header Cache-Control "public, max-age=31536000, immutable";
114114

115115
# Remove signature of the static files that is used to overcome the browser cache
116116
location ~ ^/static/version\d*/ {
117117
rewrite ^/static/version\d*/(.*)$ /static/$1 last;
118118
}
119119

120120
location ~* \.(ico|jpg|jpeg|png|gif|svg|svgz|webp|avif|avifs|js|css|eot|ttf|otf|woff|woff2|html|json|webmanifest)$ {
121-
add_header Cache-Control "public";
121+
add_header Cache-Control "public, max-age=31536000, immutable";
122122
add_header X-Frame-Options "SAMEORIGIN";
123-
expires +1y;
124123

125124
if (!-f $request_filename) {
126125
rewrite ^/static/(version\d*/)?(.*)$ /static.php?resource=$2 last;

pub/static/.htaccess

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ AddType application/xml xml
7575
<IfModule mod_headers.c>
7676

7777
<FilesMatch .*\.(ico|jpg|jpeg|png|gif|svg|webp|avif|avifs|js|css|eot|ttf|otf|woff|woff2|html|json|webmanifest)$>
78-
Header append Cache-Control public
78+
Header append Cache-Control "public, max-age=31536000, immutable"
7979
</FilesMatch>
8080

8181
<FilesMatch .*\.(zip|gz|gzip|bz2|csv|xml)$>

0 commit comments

Comments
 (0)