Skip to content

Commit 48ca7e3

Browse files
author
Hayder Sharhan
committed
MAGETWO-49876: Add improvements for varnish vcl files #2028
- Revised comments added by contributor.
1 parent 6f4235b commit 48ca7e3

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

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

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,7 @@ sub vcl_recv {
5151
# collect all cookies
5252
std.collect(req.http.Cookie);
5353

54-
# Even though there are few possible values for Accept-Encoding, Varnish treats
55-
# them literally rather than semantically, so even a small difference which makes
56-
# no difference to the backend can reduce cache efficiency by making Varnish cache
57-
# too many different versions of an object.
58-
# https://www.varnish-cache.org/trac/wiki/FAQ/Compression
54+
# Compression filter. See https://www.varnish-cache.org/trac/wiki/FAQ/Compression
5955
if (req.http.Accept-Encoding) {
6056
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|swf|flv)$") {
6157
# No point in compressing these
@@ -89,17 +85,14 @@ sub vcl_hash {
8985
hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
9086
}
9187

92-
#for multi site configurations to not cache each-other's content
88+
# For multi site configurations to not cache each other's content
9389
if (req.http.host) {
9490
hash_data(req.http.host);
9591
} else {
9692
hash_data(server.ip);
9793
}
9894

99-
# mainly to make sure, if the site was cached via a http connection and a visitor opens the
100-
# https version, they won't see an ssl warning about mixed content (if the site was cached via http
101-
# connection, the external resources like css, js will be opened via an http connection as well
102-
# instead of https
95+
# To make sure http users don't see ssl warning
10396
if (req.http.X-Forwarded-Proto) {
10497
hash_data(req.http.X-Forwarded-Proto);
10598
}

0 commit comments

Comments
 (0)