Skip to content

Commit b56de51

Browse files
author
Magento CICD
authored
MAGETWO-65007: [GitHub][PR] Set static html fragments as cacheable #8000
2 parents c323f7b + ff352cb commit b56de51

File tree

3 files changed

+9
-4
lines changed

3 files changed

+9
-4
lines changed

app/code/Magento/PageCache/etc/varnish4.vcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ sub vcl_recv {
9797
set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
9898

9999
# static files are always cacheable. remove SSL flag and cookie
100-
if (req.url ~ "^/(pub/)?(media|static)/.*\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)$") {
100+
if (req.url ~ "^/(pub/)?(media|static)/.*\.(ico|html|css|js|jpg|jpeg|png|gif|tiff|bmp|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)$") {
101101
unset req.http.Https;
102102
unset req.http./* {{ ssl_offloaded_header }} */;
103103
unset req.http.Cookie;

app/code/Magento/PageCache/etc/varnish5.vcl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ sub vcl_recv {
9898
set req.url = regsuball(req.url,"&gclid=[^&]+",""); # strips when QS = "?foo=bar&gclid=AAA" or QS = "?foo=bar&gclid=AAA&bar=baz"
9999

100100
# static files are always cacheable. remove SSL flag and cookie
101-
if (req.url ~ "^/(pub/)?(media|static)/.*\.(ico|css|js|jpg|jpeg|png|gif|tiff|bmp|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)$") {
101+
if (req.url ~ "^/(pub/)?(media|static)/.*\.(ico|html|css|js|jpg|jpeg|png|gif|tiff|bmp|mp3|ogg|svg|swf|woff|woff2|eot|ttf|otf)$") {
102102
unset req.http.Https;
103103
unset req.http./* {{ ssl_offloaded_header }} */;
104104
unset req.http.Cookie;

pub/static/.htaccess

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ Options -MultiViews
2828
AddType application/javascript js jsonp
2929
AddType application/json json
3030

31+
# HTML
32+
33+
AddType text/html html
34+
3135
# CSS
3236
AddType text/css css
3337

@@ -89,11 +93,12 @@ AddType application/xml xml
8993
ExpiresByType application/x-gzip "access plus 0 seconds"
9094
ExpiresByType application/x-bzip2 "access plus 0 seconds"
9195

92-
# CSS, JavaScript
93-
<FilesMatch \.(css|js)$>
96+
# CSS, JavaScript, html
97+
<FilesMatch \.(css|js|html)$>
9498
ExpiresDefault "access plus 1 year"
9599
</FilesMatch>
96100
ExpiresByType text/css "access plus 1 year"
101+
ExpiresByType text/html "access plus 1 year"
97102
ExpiresByType application/javascript "access plus 1 year"
98103

99104
# Favicon, images, flash

0 commit comments

Comments
 (0)