New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cloudflare exclusions do not appear to be working 4.7.1, craft 4.5.5 #580
Comments
Can you share your URI pattern settings and what specifically is not working? |
Visiting a uri such as Here is our blitz config: <?php
use craft\helpers\App;
$env = App::env('ENVIRONMENT');
return array_merge(
[
// With this setting enabled, Blitz will log detailed messages to `storage/logs/blitz.log`.
'debug' => $env !== 'production',
// With this setting enabled, Blitz will begin caching pages according to the included/excluded URI patterns. Disable this setting to prevent Blitz from caching any new pages.
'cachingEnabled' => $env !== 'dev',
// Determines when and how the cache should be refreshed.
// - `0`: Expire the cache, regenerate manually or organically
// - `1`: Clear the cache, regenerate manually or organically
// - `2`: Expire the cache and regenerate in a queue job
// - `3`: Clear the cache and regenerate in a queue job
'refreshMode' => 1,
// The URI patterns to include in caching. Set `siteId` to a blank string to indicate all sites.
'includedUriPatterns' => [
[
'siteId' => 1,
'uriPattern' => '.*',
],
],
// The URI patterns to exclude from caching (overrides any matching patterns to include). Set `siteId` to a blank string to indicate all sites.
'excludedUriPatterns' => [
[
'siteId' => 1,
'uriPattern' => 'booking/.*',
],
[
'siteId' => 1,
'uriPattern' => 'feed/.*',
],
[
'siteId' => 1,
'uriPattern' => 'preview-holiday-listing',
],
],
// The storage type to use.
'cacheStorageType' => 'putyourlightson\blitz\drivers\storage\YiiCacheStorage',
// The maximum length of URIs that may be cached. Increasing this value requires manually updating the limit in the `uri` column of the `blitz_caches` database table. Note that the prefix length limit is 3072 bytes for InnoDB tables that use the DYNAMIC or COMPRESSED row format. Assuming a `utf8mb4` character set and a maximum of 4 bytes for each character, this is 768 characters.
// https://dev.mysql.com/doc/refman/8.0/en/column-indexes.html#column-indexes-prefix
// Warning: if using the File Storage driver, this value should not exceed 255 unless using a file system that supports longer file names.
// https://en.wikipedia.org/wiki/Comparison_of_file_systems#Limits
'maxUriLength' => 600,
// Whether URLs with query strings should be cached and how.
// - `0`: Do not cache URLs with query strings
// - `1`: Cache URLs with query strings as unique pages
// - `2`: Cache URLs with query strings as the same page
'queryStringCaching' => 1,
// The query string parameters to exclude when determining if and how a page should be cached (regular expressions may be used).
'excludedQueryStringParams' => [
[
'siteId' => '1',
'queryStringParam' => 'success',
],
[
'siteId' => '1',
'queryStringParam' => 'noblitz',
],
],
// Whether pages containing query string parameters should be generated.
'generatePagesWithQueryStringParams' => true,
// Whether the cache should automatically be refreshed after a global set is updated.
'refreshCacheAutomaticallyForGlobals' => false,
// Whether the cache should be refreshed when an element is moved within a structure.
'refreshCacheWhenElementMovedInStructure' => false,
// Whether the cache should be refreshed when an element is saved but unchanged.
'refreshCacheWhenElementSavedUnchanged' => false,
// Whether the cache should be refreshed when an element is saved but not live.
'refreshCacheWhenElementSavedNotLive' => false,
// Whether an `X-Powered-By: Blitz` header should be sent.
'sendPoweredByHeader' => false,
],
$env === 'dev'
? []
// Production & Staging - Cloudflare
: [
// The generator type to use.
'cacheGeneratorType' => 'putyourlightson\blitz\drivers\generators\HttpGenerator',
// The generator settings.
'cacheGeneratorSettings' => ['concurrency' => 3],
// The purger type to use.
'cachePurgerType' => 'putyourlightson\blitz\drivers\purgers\CloudflarePurger',
// The purger settings (zone ID keys are site UIDs).
'cachePurgerSettings' => [
'zoneIds' => [
// This key is the "siteuid" assigned to the chosen site in the `sites` database table
'xxx-xxx-xxx-xxx-xxx' => [
'zoneId' => App::parseEnv('$CLOUDFLARE_ZONE_ID'),
],
],
'authenticationMethod' => 'apiKey',
'email' => App::parseEnv('$CLOUDFLARE_EMAIL'),
'apiKey' => App::parseEnv('$CLOUDFLARE_API_KEY'),
],
],
); |
Is the page being cached on Cloudflare only (and not by Blitz)? If that’s the case then perhaps “Browser Cache TTL” is not set to “Respect Existing Headers”? See the docs at https://putyourlightson.com/plugins/blitz#cloudflare-page-rules |
Can you send me a URL to the page in question, either here or via email at support@putyourlightson.com? |
Just emailed you, thanks! |
Thanks for your patience with this. The next version of Blitz adds a new You can test this by running |
Released in 4.8.0. |
Hey,
I have just migrated an app to another host. This used to work on the old host so not sure if that may play a part but, it looks like the excluded URIs are no longer honoured and I have had to setup a page rule in Cloudflare to explicitly ignore a checkout uri pattern.
It looked like we had a temp issue where blitz not being able to connect with cloudflare in the blitz settings area but that appears to have gone for now.
Do you have any ideas about what this could be?
The text was updated successfully, but these errors were encountered: