File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
app/code/Magento/PageCache/etc Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -41,8 +41,8 @@ sub vcl_recv {
41
41
return (pass );
42
42
}
43
43
44
- # Bypass shopping cart and checkout requests
45
- if (req.url ~ " /checkout" ) {
44
+ # Bypass shopping cart and checkout and search requests
45
+ if (req.url ~ " /checkout" || req.url ~ " /catalogsearch " ) {
46
46
return (pass );
47
47
}
48
48
@@ -136,6 +136,18 @@ sub vcl_backend_response {
136
136
set beresp.grace = 1m ;
137
137
}
138
138
}
139
+
140
+ #If page is not cacheable then bypass varnish for 2 minutes as Hit-For-Pass
141
+ if (beresp.ttl <= 0s ||
142
+ beresp.http.Surrogate-control ~ " no-store" ||
143
+ (!beresp.http.Surrogate-Control && beresp.http.Vary == " *" )) {
144
+ /*
145
+ * Mark as "Hit-For-Pass" for the next 2 minutes
146
+ */
147
+ set beresp.ttl = 120s ;
148
+ set beresp.uncacheable = true ;
149
+ }
150
+ return (deliver );
139
151
}
140
152
141
153
sub vcl_deliver {
You can’t perform that action at this time.
0 commit comments