Skip to content

Commit

Permalink
Merge remote-tracking branch 'ext/MAGETWO-54228-Varnish-cache-disable…
Browse files Browse the repository at this point in the history
…d' into pull-request
  • Loading branch information
Cari Spruiell committed Jun 11, 2016
2 parents 1164adc + 8ac29f0 commit ce87aa4
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
4 changes: 2 additions & 2 deletions app/code/Magento/PageCache/etc/varnish3.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ sub vcl_recv {
return (pass);
}

# Bypass shopping cart and checkout requests
if (req.url ~ "/checkout") {
# Bypass shopping cart, checkout and search requests
if (req.url ~ "/checkout" || req.url ~ "/catalogsearch") {
return (pass);
}

Expand Down
14 changes: 12 additions & 2 deletions app/code/Magento/PageCache/etc/varnish4.vcl
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ sub vcl_recv {
return (pass);
}

# Bypass shopping cart and checkout requests
if (req.url ~ "/checkout") {
# Bypass shopping cart, checkout and search requests
if (req.url ~ "/checkout" || req.url ~ "/catalogsearch") {
return (pass);
}

Expand Down Expand Up @@ -136,6 +136,16 @@ sub vcl_backend_response {
set beresp.grace = 1m;
}
}

# If page is not cacheable then bypass varnish for 2 minutes as Hit-For-Pass
if (beresp.ttl <= 0s ||
beresp.http.Surrogate-control ~ "no-store" ||
(!beresp.http.Surrogate-Control && beresp.http.Vary == "*")) {
# Mark as Hit-For-Pass for the next 2 minutes
set beresp.ttl = 120s;
set beresp.uncacheable = true;
}
return (deliver);
}

sub vcl_deliver {
Expand Down

0 comments on commit ce87aa4

Please sign in to comment.