From 7a8cc55ee54f866bf80b54168cd925957d7b26f3 Mon Sep 17 00:00:00 2001 From: JamesToothill Date: Fri, 21 Dec 2018 13:13:23 +0000 Subject: [PATCH] Skip cache if Ajax request Previously it was assumed an ajax request was a POST but you could be GET'ing via ajax (to get live content and skip out the html cache). --- src/services/HtmlcacheService.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/services/HtmlcacheService.php b/src/services/HtmlcacheService.php index be803ed..789ffad 100755 --- a/src/services/HtmlcacheService.php +++ b/src/services/HtmlcacheService.php @@ -106,10 +106,14 @@ public function canCreateCacheFile() if (\Craft::$app->request->getIsLivePreview()) { return false; } - // Skip if it's a post/ajax request + // Skip if it's a post request if (!\Craft::$app->request->getIsGet()) { return false; } + // Skip if it's an ajax request + if (\Craft::$app->request->getIsAjax()) { + return false; + } // Skip if route from element api if ($this->isElementApiRoute()) { return false;