@@ -134,7 +134,7 @@ public function getIsCacheableRequest(): bool
134134 }
135135
136136 if ($ request ->getIsActionRequest ()
137- && !Blitz:: $ plugin -> settings -> cacheActionRequests
137+ && !$ this -> getIsCacheableActionRequest ()
138138 ) {
139139 return false ;
140140 }
@@ -216,7 +216,10 @@ public function getIsCacheableSiteUri(?SiteUriModel $siteUri): bool
216216
217217 $ uri = mb_strtolower ($ siteUri ->uri );
218218
219- if (Blitz::$ plugin ->settings ->onlyCacheLowercaseUris && $ uri !== $ siteUri ->uri ) {
219+ if (Blitz::$ plugin ->settings ->onlyCacheLowercaseUris
220+ && $ uri !== $ siteUri ->uri
221+ && !$ this ->getIsCacheableActionRequest ()
222+ ) {
220223 Blitz::$ plugin ->debug ('Page not cached because the URI contains uppercase characters. ' , [], $ siteUri ->uri );
221224
222225 return false ;
@@ -251,7 +254,7 @@ public function getIsCacheableSiteUri(?SiteUriModel $siteUri): bool
251254 // Ignore URIs that contain `index.php` but that are not action requests
252255 $ generalConfig = Craft::$ app ->getConfig ()->getGeneral ();
253256 $ pattern = '/index\.php(?!\? ' . preg_quote ($ generalConfig ->pathParam ) . '= ' . preg_quote ($ generalConfig ->actionTrigger ) . '\/)/ ' ;
254- if (preg_match ($ pattern , $ uri, $ m )) {
257+ if (preg_match ($ pattern , $ uri )) {
255258 Blitz::$ plugin ->debug ('Page not cached because the URL contains `index.php`. ' , [], $ url );
256259
257260 return false ;
@@ -270,7 +273,9 @@ public function getIsCacheableSiteUri(?SiteUriModel $siteUri): bool
270273 return false ;
271274 }
272275
273- if (Blitz::$ plugin ->settings ->queryStringCaching === SettingsModel::QUERY_STRINGS_DO_NOT_CACHE_URLS ) {
276+ if (Blitz::$ plugin ->settings ->queryStringCaching === SettingsModel::QUERY_STRINGS_DO_NOT_CACHE_URLS
277+ && !$ this ->getIsCacheableActionRequest ()
278+ ) {
274279 $ queryStringParams = QueryStringHelper::getValidQueryStringParams ($ siteUri ->uri );
275280
276281 if (!empty ($ queryStringParams )) {
@@ -342,6 +347,17 @@ public function getIsDynamicInclude(string $uri = null): bool
342347 return false ;
343348 }
344349
350+ /**
351+ * Returns whether this is a cacheable action request.
352+ *
353+ * @since 5.11.1
354+ */
355+ public function getIsCacheableActionRequest (): bool
356+ {
357+ return Craft::$ app ->getRequest ()->getIsActionRequest ()
358+ && Blitz::$ plugin ->settings ->cacheActionRequests ;
359+ }
360+
345361 /**
346362 * Returns whether this is a generator request.
347363 *
0 commit comments