File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
app/code/Magento/PageCache/etc Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -49,8 +49,8 @@ sub vcl_recv {
49
49
return (pass );
50
50
}
51
51
52
- # Bypass shopping cart and checkout requests
53
- if (req.url ~ " /checkout" ) {
52
+ # Bypass shopping cart, checkout and search requests
53
+ if (req.url ~ " /checkout" || req.url ~ " /catalogsearch " ) {
54
54
return (pass );
55
55
}
56
56
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, checkout and search requests
45
+ if (req.url ~ " /checkout" || req.url ~ " /catalogsearch " ) {
46
46
return (pass );
47
47
}
48
48
@@ -136,6 +136,16 @@ 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
+ # Mark as Hit-For-Pass for the next 2 minutes
145
+ set beresp.ttl = 120s ;
146
+ set beresp.uncacheable = true ;
147
+ }
148
+ return (deliver );
139
149
}
140
150
141
151
sub vcl_deliver {
You can’t perform that action at this time.
0 commit comments