Let's say if the bundle.js
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?
(By the way, it is said that Cache-control: max-age
is HTTP/1.1 and if it and Expires:
are both present, Cache-control
overrides the Expires
header.)
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?)
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 bundle.53ae823.js
or bundle.2020-03-12-08.js
, 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?