Closed luke-nehemedia closed 4 years ago
First check the common issues and if you don't find a solution there then enabling the debug config setting should help you figure out why pages are not being cached.
Thanks for the answer. I already went through the common issues, but nothing helped.
Enabling the debug setting results in messages stating, that...
Page not cached because it does not match an included URI pattern.
However, as stated above, everything is included in the URI pattern. I also removed the exceptions temporarily, which did not resolve the problem.
I have tried out a couple of other things:
All sites => .*
works for all but one site. However, I do not want to cache all sites, but only three of them.*
did not helpWhat is the base URL set to in the site settings for the secondary site? Is it an absolute URL? Can you compare it to the exact URL in the log file message?
The base URLs of the secondary sites are all absolute URLs set via the CP, not via environmental variables etc.
They do match exactly the URLs given in the Log-file.
Ok, can you send the log file to info@putyourlightson.net and we'll take a closer look?
I just mailed the log-files and screenshots (without blacked-out parts) of the Blitz-Settings and Site-Settings.
I have the same/similar Problem. Only the primary site gets cached when prewarming. However, single pages of all sites are cached when visited.
Plugin version: 3.1.0 Craft version: 3.3.18.2
@sarahschuetz Have you tried enabling the debug config setting and what is the result of the log?
Also, is the base URL in the site settings for the secondary site an absolute URL? Please ensure that you are not using @web
(without defining it explicitly).
I was also similar experiencing issues with Blitz on a multi-site website yesterday, but instead it was returning stale cached versions for pages, and whatever I did I wasn't able to clear the cache for the localised site.
I realised the issue was with my config settings as I was using a relative path ('folderPath' => 'cache/blitz') as per the v2 config file. There seemed to be a discrepancy between the files being stored in the web root for the primary site (/web/cache/blitz/example.com) and the web root for the localised site (/web/zh-hans/cache/blitz/example.com/zh-hans). After changing this to an absolute folder path rather than relative in the config via an ENV variable (e.g. /home/user/example.com/web/cache/blitz) it appeared to work as expected and all cached files were being stored in the primary web root rather than in any additional sites' web root. It seems the v3 config now uses ['folderPath' => '@webroot/cache/blitz'].
It could be because I'm using a nested web root for the localised site that this occurred in the first place, it may not be the case for separate web roots, or multi site where there's a single web root.
Not sure if that's applicable for any other cases here, but that certainly helped my issue. FYI the above config was seemingly working fine for a while until I recently updated Blitz.
@bendesilva Thank you for your input. You're right that the folder path was changed from a relative path to an absolute path , so in version 3 it should be @webroot/cache/blitz
or similar.
The update migration from v2 to v3 automatically added the @webroot
prefix to the folder path, but the setting probably got overwritten when you performed a more recent update to Blitz and saved the settings with the old folder path value set in your config file.
I'm not sure if this is the same issue that @luke-nehemedia and @sarahschuetz are facing, but it would be worthwhile double checking.
@bencroker sorry, for my late response and thank you for your effort. I just had time to review the issue again and came up with the following results:
@webroot/blitz/cache
@baseUrl
and resolve to http://xxx.test/
, http://xxx.test/r/
, http://xxx.test/en/r
etc.Here is an excerpt of the logs:
2020-02-11 11:15:48 [][][debug] Template not found: c/datenschutzbestimmungen
2020-02-11 11:15:48 [][][debug] Template not found: c/termine-und-preise-1
2020-02-11 11:15:48 [][][debug] Template not found: c/anmeldebestaetigung-ausbildungsplatz
2020-02-11 11:17:16 [][][debug] Page not cached because it matches an excluded URI pattern. [http://xxx.test/csrf/]
2020-02-11 11:20:50 [][][debug] Page not cached because it matches an excluded URI pattern. [http://xxx.test/csrf/]
@sarahschuetz where exactly are you defining @baseUrl
for the various sites? Can you show the specific code sample?
@bencroker the aliases are defined in config/general.php
:
'aliases' => [
'@baseUrl' => getenv('SITE_URL'),
'@baseUrlEn' => getenv('SITE_URL') . 'en/',
'@baseUrlB2b' => getenv('SITE_URL') . 'r/',
'@baseUrlB2bEn' => getenv('SITE_URL') . 'en/r/',
'@baseUrlxxxDe' => getenv('SITE_URL') . 'c/',
'@baseUrlxxxEn' => getenv('SITE_URL') . 'en/c/',
],
... and SITE_URL
in my .env
file is:
SITE_URL="http://xxx.test/"
That looks good @sarahschuetz. Can you send the log file (be sure to enable the debug config setting first), detailing what URL specifically is not being warmed, to info@putyourlightson.net and I'll take a closer look? If you are able to send login credentials then that would be helpful too.
Please test using the Guzzle warmer, which is the recommended warmer. The Local warmer is not as stable for multi-site setups.
@bencroker Thanks for all your help. Using Guzzle Warmer all our multi-sites are cached now 🎉
Great, glad to hear it!
Hello again
I am very sorry to answer that late, but due to personal circumstances I wasn't able to work on this project in the meantime.
Sadly enough, the problem is still there.
Some stuff I have tried with regard to the conversation:
'cacheStorageSettings' => ['folderPath' => '@webroot/cache/blitz']
webroot... /cache/blitz/ domain
@webroot/...
) and then warm the cache, it caches the main site (as supposed to), not the other language versions (which is should cache) and it caches a secondary site, for which caching is not enabled! Even when I explicitly put that site into the exclude rules. Really strange! I have really no idea why it behaves so strange. On all other sites it works just fine. However, none of the other ones is a multisite.
@luke-nehemedia Please email credentials to the site to info@putyourlightson.net and we'll take a closer look.
You should have received the credentials now.
Latest update solved the issue! Thank you!
@bencroker I have the same problem on multisite setup. Blitz caching is enabled and 'Included URI Patterns' left empty only to cache the homepage. It caches only the primary website but not the other websites. I've tried with .*
but no difference there.
Craft version: 3.4.27
Blitz version: 3.8
Urls are generated via .env file and general.php.
ENV:
BASE_URL="https://local.page.com/"
general.php:
'aliases' => [ 'baseUrl' => trim(getenv('BASE_URL'), '/'), ],
When I enable the debug mode then I'm just getting:
2021-04-22 08:41:43 [][6][debug] Page not cached because it does not match an included URI pattern. [https://local.page.com/nl]
@belkin this issue is closed and over a year old. Please create a new issue with some more details/screenshots of your settings and we'll take a look.
I am testing blitz right now for a new client and have used it on two other sites for quite a while. Until now without major problems.
This time, however, the site has multiple languages with multiple domains. I have et it up to include all urls of the 3 main languages (by choosing the site and entering
.*
. I have excluded some sites that include forms. I also added the Rewrite rules to the .htaccess file.I visited the site on multiple devices and clicked on "warm cache." As a result, it cached the first language, but left the other sites untouched.
I tried a couple of things:
However, I could not get the plugin to cache the other language versions.
Any idea how to solve this?
Versions