title: How long should we set the HTTP Expires or Cache-control: max-age header?
body: <p>Let's say if the <code>bundle.js</code> is 750kb, is it true that if you set it to "never expire" or "expire in 10 years", then the browser doesn't need to fetch that file and therefore can make your website and pageload faster?</p>
  
  <p>(By the way, it is said that <code>Cache-control: max-age</code> is HTTP/1.1 and <a href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Expires" rel="nofollow noreferrer">if it and <code>Expires:</code> are both present, <code>Cache-control</code> overrides the <code>Expires</code> header</a>.)</p>
  
  <p>What if you have a weekly or 2-month release cycle, should you set the Expires header to 1 week or 2 months? I was thinking that with a weekly release cycle, some of your JavaScript or CSS files may stay the same, so it may be good to just set it to expire in 6 months or even 10 years? (because one week later it hasn't changed?)</p>
  
  <p>But what if your file changed but the browser doesn't fetch it?  Is it true that if you use the ETag mechanism, or if you use <code>bundle.53ae823.js</code> or <code>bundle.2020-03-12-08.js</code>, then you can "force" it to expire by the ETag being different, or the file name being different?  What is a good way to set the Expires header length?</p>