Answers.Body: <p>The <code>header</code> tag sets an HTTP response header, which may be used to (among other things) tell the <em>browser</em> that the response content is "cacheable".</p>
  
  <p>The <code>cache</code> tag tells Craft to cache the generated HTML on the <em>server</em> side (as a file).</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T18:58:33.257Z
Answers.Text: Cache tag is clear to me what it does now. Do I need something else to cache a webpage except the code from documentation about the header tag? That's another question...
Answers.UserDisplayName: Dominik Krulak
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T19:15:38.340Z
Answers.Text: You wouldn't typically set the cache headers in Craft. That's usually a job for your Apache / nginx config.
Answers.UserDisplayName: Stephen Lewis
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2017-03-20T18:48:21.050Z
Answers.LastActivityDate: 2017-03-20T18:48:21.050Z
Answers.UserDisplayName: Stephen Lewis
Body: <p>I've came to a cache problem/question on one of my sites when I run a speed test and I failed caching test. I have very little knowledge in this area and I'd like to enhance it.</p>
  
  <p>Documentation for <a href="https://craftcms.com/docs/templating/header" rel="nofollow noreferrer">{% header %}</a> tag says that it set a new HTTP header in response and you can tell browser what to do <em>(for example caching a page)</em>.</p>
  
  <p>Documentation for <a href="https://craftcms.com/docs/templating/cache" rel="nofollow noreferrer">{% cache %}</a> tag say that it will cache a portion of your template.</p>
  
  <p>So what's the difference in setting cache in HTTP header using <code>{% header %}</code> tag and <code>{% cache %}</code> tag?</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-20T18:38:35.243Z
Comments.Text: I found [this article](https://varvy.com/pagespeed/leverage-browser-caching.html) about leveraging browser caching. Is `{% header %}` tag about enabling cache and setting it what to cache for a site?
Comments.UserDisplayName: Dominik Krulak
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-03-20T20:12:12.150Z
Comments.Text: Probably worth reading: http://craftcms.stackexchange.com/a/13383/57
Comments.UserDisplayName: Brad Bell
Tags: <cache>
Title: What's the difference between setting cache with {% header %} tag and {% cache %} tag?
ThreadText: # What's the difference between setting cache with {% header %} tag and {% cache %} tag?
  
  (Asked by: username_0 on 2017-03-20)
  
  I've came to a cache problem/question on one of my sites when I run a speed test and I failed caching test. I have very little knowledge in this area and I'd like to enhance it.
  
  Documentation for [{% header %}](https://craftcms.com/docs/templating/header) tag says that it set a new HTTP header in response and you can tell browser what to do *(for example caching a page)*.
  
  Documentation for [{% cache %}](https://craftcms.com/docs/templating/cache) tag say that it will cache a portion of your template.
  
  So what's the difference in setting cache in HTTP header using `{% header %}` tag and `{% cache %}` tag?
  
  **Tags:** cache
  
  > **Comments:**
  > **username_0**: I found [this article](https://varvy.com/pagespeed/leverage-browser-caching.html) about leveraging browser caching. Is `{% header %}` tag about enabling cache and setting it what to cache for a site?  
  > **username_1**: Probably worth reading: http://craftcms.stackexchange.com/a/13383/57  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2017-03-20. Score: 4 | Accepted answer
  
  The `header` tag sets an HTTP response header, which may be used to (among other things) tell the *browser* that the response content is "cacheable".
  
  The `cache` tag tells Craft to cache the generated HTML on the *server* side (as a file).
  
  > **Comments:**
  > **username_0**: Cache tag is clear to me what it does now. Do I need something else to cache a webpage except the code from documentation about the header tag? That's another question...  
  > **username_2**: You wouldn't typically set the cache headers in Craft. That's usually a job for your Apache / nginx config.  
  
  ---
  
  