Skip to content

Commit 1f3737b

Browse files
prevent several cache versions for static files because of X-Magento-Vary cookie
1 parent 1a490f5 commit 1f3737b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,18 @@ sub vcl_recv {
4646
if (req.request != "GET" && req.request != "HEAD") {
4747
return (pass);
4848
}
49+
50+
# normalize url in case of leading HTTP scheme and domain
51+
set req.url = regsub(req.url, "^http[s]?://[^/]+", "");
52+
53+
# collect all cookies
54+
std.collect(req.http.Cookie);
55+
56+
# static files are always cacheable. remove SSL flag and cookie
57+
if (req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$") {
58+
unset req.http.Https;
59+
unset req.http.Cookie;
60+
}
4961

5062
set req.grace = 1m;
5163

0 commit comments

Comments
 (0)