<p>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?</p>

<pre><code>{% 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" %}
</code></pre>

CC BY-SA 3.0
2015-07-29T19:46:54.747Z
What kind of templates are that? And what are the cache-control set to?
André Elvan
CC BY-SA 3.0
2015-07-29T19:57:03.050Z
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.
a-am
CC BY-SA 3.0
2015-07-29T20:16:19.933Z
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
<cache>
Set Cache-Control is being overridden
# Set Cache-Control is being overridden

(Asked by: username_0 on 2015-07-29)

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" %}

**Tags:** cache

> **Comments:**
> **username_1**: What kind of templates are that? And what are the cache-control set to?  
> **username_0**: 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.  
> **username_2**: 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.  

---

## 0 answers

