Skip to content

Commit 7660725

Browse files
author
Guillaume Quintard
committed
[vcl] don't explicitly hash the host header
Hashing `req.http.host`/`client.ip` is already handled by the [built-in vcl](https://github.com/varnishcache/varnish-cache/blob/6.0/bin/varnishd/builtin.vcl#L86) so there's no need to repeat it explicitly. It's also a bit confusing as `req.url` is not explicitly handled, even though it's a more important hash input than the host. note: all versions have been changed for the sake of consistency but both the 4.x and 5.x series have been EOL'd a (long) while ago and users should be encouraged to upgraded as soon as possible.
1 parent def5104 commit 7660725

File tree

3 files changed

+0
-21
lines changed

3 files changed

+0
-21
lines changed

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -121,13 +121,6 @@ sub vcl_hash {
121121
hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
122122
}
123123

124-
# For multi site configurations to not cache each other's content
125-
if (req.http.host) {
126-
hash_data(req.http.host);
127-
} else {
128-
hash_data(server.ip);
129-
}
130-
131124
if (req.url ~ "/graphql") {
132125
call process_graphql_headers;
133126
}

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,6 @@ sub vcl_hash {
122122
hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
123123
}
124124

125-
# For multi site configurations to not cache each other's content
126-
if (req.http.host) {
127-
hash_data(req.http.host);
128-
} else {
129-
hash_data(server.ip);
130-
}
131-
132125
# To make sure http users don't see ssl warning
133126
if (req.http./* {{ ssl_offloaded_header }} */) {
134127
hash_data(req.http./* {{ ssl_offloaded_header }} */);

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

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -122,13 +122,6 @@ sub vcl_hash {
122122
hash_data(regsub(req.http.cookie, "^.*?X-Magento-Vary=([^;]+);*.*$", "\1"));
123123
}
124124

125-
# For multi site configurations to not cache each other's content
126-
if (req.http.host) {
127-
hash_data(req.http.host);
128-
} else {
129-
hash_data(server.ip);
130-
}
131-
132125
# To make sure http users don't see ssl warning
133126
if (req.http./* {{ ssl_offloaded_header }} */) {
134127
hash_data(req.http./* {{ ssl_offloaded_header }} */);

0 commit comments

Comments
 (0)