From 4ee50746712c261831a042a3e403a64bd1a7f26e Mon Sep 17 00:00:00 2001 From: Igor Melnikov Date: Wed, 28 Oct 2015 01:39:21 -0500 Subject: [PATCH] MAGETWO-44448: Checkout requests become bottleneck on Varnish 4 due to grace mode Adding regular expression to allow Varnish bypass shopping cart and checkout requests --- app/code/Magento/PageCache/etc/varnish3.vcl | 7 ++++++- app/code/Magento/PageCache/etc/varnish4.vcl | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/PageCache/etc/varnish3.vcl b/app/code/Magento/PageCache/etc/varnish3.vcl index 678244bb6f790..70a56aa46f052 100644 --- a/app/code/Magento/PageCache/etc/varnish3.vcl +++ b/app/code/Magento/PageCache/etc/varnish3.vcl @@ -46,7 +46,12 @@ sub vcl_recv { if (req.request != "GET" && req.request != "HEAD") { return (pass); } - + + # Bypass shopping cart and checkout requests + if (req.url ~ "/checkout") { + return (pass); + } + # normalize url in case of leading HTTP scheme and domain set req.url = regsub(req.url, "^http[s]?://", ""); diff --git a/app/code/Magento/PageCache/etc/varnish4.vcl b/app/code/Magento/PageCache/etc/varnish4.vcl index d9ff63e5e9fa2..17eeef0ce9c94 100644 --- a/app/code/Magento/PageCache/etc/varnish4.vcl +++ b/app/code/Magento/PageCache/etc/varnish4.vcl @@ -40,6 +40,11 @@ sub vcl_recv { return (pass); } + # Bypass shopping cart and checkout requests + if (req.url ~ "/checkout") { + return (pass); + } + # normalize url in case of leading HTTP scheme and domain set req.url = regsub(req.url, "^http[s]?://", "");