0

I have a production website for quite a long time now. By digging, we found that the Cache-Control was always to "no-cache" and "X-Drupal-Dynamic-Cache" is UNCACHEABLE

enter image description here

My settings.prod.php look like this

# ================================================================
# Performance settings
# ================================================================
$config['system.logging']['error_level'] = ERROR_REPORTING_HIDE;
$config['system.performance']['cache']['page']['max_age'] = 86400;
$config['system.performance']['css']['preprocess'] = TRUE;
$config['system.performance']['css']['gzip'] = TRUE;
$config['system.performance']['js']['preprocess'] = TRUE;
$config['system.performance']['js']['gzip'] = TRUE;

And this is my services.prod.yml

parameters:
  http.response.debug_cacheability_headers: false
  twig.config:
    debug: false
    auto_reload: false
    cache: true

I have both dynamic_page_cache and page_cache enable on the website, because we have both anonymous and logged users.

Furthermore, the config settings is not display in the backend System > Development > Performance, is the cache really activated like this ?

4
  • 4
    Yes, config overrides don’t show up on the admin form unless the module developers have written some code to make that happen (some do but most don’t). Rather than global settings, it feels likely that something in the page build is declaring itself as uncacheable, and that’s bubbling up to the top level. You might have something varying on date, for example, sometimes people hook up the footer copyright year to a dynamic var without realising the cache implications
    – Clive
    Jul 12 at 13:57
  • 3
    If you're on D9.5 or above you could try turning this caching debug on and it might help trace what is causing the uncachable drupal.org/node/3162480 Common things like captchas and the facets module can cause the whole page to be uncachable Jul 12 at 14:25
  • 2
    I agree with the commenters above. This isn't about site settings but rather something a module is doing.
    – cilefen
    Jul 12 at 14:57
  • 1
    There are many factors that could make a page not cacheable, including a session containing data.
    – apaderno
    Jul 12 at 18:51

1 Answer 1

0

I've uninstall page_cache and keept dynamic_page_cache to have a max-age=3600 enabled.

I've also remove a remaining killswitch which causes issue with custom block.

As it is a context user website (drupal commerce), when the user is adding a product, x-dynamic-cache became uncacheable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.