You're using Call-to-action forms, for example great Webforms on many Drupal 8+ (9 / 10 / ...) pages and you're wondering why your pages are slow and eventually not cached?
While placing CTA-forms on pages can be a very good idea for conversions, the CAPTCHAs and other spam-prevention methods used can kill your Drupal cache!
I won't go into details here and only link some of the issues (please help to find better solutions there), but there are reasons, why some spam prevention methods don't work with cache! (And others do!):
Captcha:
- https://www.drupal.org/project/captcha/issues/2492681
- https://www.drupal.org/project/captcha/issues/3311443
- https://www.drupal.org/project/captcha/issues/3311447 (planning to fix this using AJAX)
Honeypot:
- https://www.drupal.org/project/honeypot/issues/2782903
- https://www.drupal.org/project/honeypot/issues/2820400 (planning to fix this using AJAX)
So as written above, please help to improve the situation in these issues
As of 2022-09 I found the following:
Page / render cache killing spam protection modules:
- Honeypot
- CAPTCHA: Image, Math
Non Cache-killing Spam protection modules:
- reCaptcha
- Antibot
- riddler (CAPTCHA contrib module) - With one question! (>1 disables cache)
How to check if cache is hit?
There are some ways to check if cache is hit. One can be found in this very interesting article: https://alvinalexander.com/source-code/how-test-drupal8-pages-cached-ca…
Simply call
curl -I https://www.example.com
in your bash and check if x-cache-status: HIT
is present. Better call it 2x, if your cache may have been cold before, to be sure you get the correct results. The first call warms the cache then, the second can tell you, if caching works!
Drupal 9.5 introduces a setting for easier cache debugging, read more about it in this change-record: https://www.drupal.org/node/3162480
P.S.:
Please help to implement https://www.drupal.org/project/icon_captcha for more privacy and removing the need to use reCaptcha! :)