We are setting our Cache-Control headers in the layout file for all templates. However some templates the Cache-Control is being overridden. Why might this be?

{% set expiry = now|date_modify('+10 minutes') %}
{% header "Cache-Control: max-age=" ~ (expiry.timestamp - now.timestamp) %}
{% header "Pragma: cache" %}
{% header "Expires: " ~ expiry|date('D, d M Y H:i:s', 'GMT') ~ " GMT" %}
  • What kind of templates are that? And what are the cache-control set to? – André Elvan Jul 29 '15 at 19:46
  • We have our base layout template which is extended by all other templates. So the layout parent template sets the head cache control settings as shown above. No other templates are setting the Cache-Control header explicitly. – aran Jul 29 '15 at 19:57
  • 1
    Maybe a plugin is setting it? I'd isolate which pages you're seeing the behavior on, then start commenting out template code to narrow down where it's occurring. – Brad Bell Jul 29 '15 at 20:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.