Skip to content

Commit 4c8e768

Browse files
author
Prabhu Ram
committed
MC-15960: Separate Graphql cache handing in VCL for the /graphql area
- Modified vcls to separate graphql cache handling
1 parent a9299e1 commit 4c8e768

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

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

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,8 @@ sub vcl_hash {
123123
hash_data(server.ip);
124124
}
125125

126-
if (req.http.Store) {
127-
hash_data(req.http.Store);
128-
}
129-
if (req.http.Content-Currency) {
130-
hash_data(req.http.Content-Currency);
126+
if (req.url ~ "graphql") {
127+
call process_graphql_headers;
131128
}
132129

133130
# To make sure http users don't see ssl warning
@@ -137,6 +134,15 @@ sub vcl_hash {
137134
/* {{ design_exceptions_code }} */
138135
}
139136

137+
sub process_graphql_headers {
138+
if (req.http.Store) {
139+
hash_data(req.http.Store);
140+
}
141+
if (req.http.Content-Currency) {
142+
hash_data(req.http.Content-Currency);
143+
}
144+
}
145+
140146
sub vcl_backend_response {
141147

142148
set beresp.grace = 3d;

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,12 @@ sub vcl_hash {
130130
}
131131
/* {{ design_exceptions_code }} */
132132

133+
if (req.url ~ "graphql") {
134+
call process_graphql_headers;
135+
}
136+
}
137+
138+
sub process_graphql_headers {
133139
if (req.http.Store) {
134140
hash_data(req.http.Store);
135141
}

0 commit comments

Comments
 (0)