Skip to content

Commit

Permalink
prevent several cache versions for static files because of X-Magento-…
Browse files Browse the repository at this point in the history
…Vary cookie
  • Loading branch information
phoenix-bjoern committed Jan 21, 2015
1 parent 1a490f5 commit 1f3737b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/code/Magento/PageCache/etc/varnish.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,18 @@ sub vcl_recv {
if (req.request != "GET" && req.request != "HEAD") {
return (pass);
}

# normalize url in case of leading HTTP scheme and domain
set req.url = regsub(req.url, "^http[s]?://[^/]+", "");

# collect all cookies
std.collect(req.http.Cookie);

# static files are always cacheable. remove SSL flag and cookie
if (req.url ~ "^/(media|js|skin)/.*\.(png|jpg|jpeg|gif|css|js|swf|ico)$") {
unset req.http.Https;
unset req.http.Cookie;
}

set req.grace = 1m;

Expand Down

0 comments on commit 1f3737b

Please sign in to comment.