Replies: 1 comment
-
I think the current (original) headers are sound defaults for most cases. The default uses a year without So, the documentation should then be updated |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In the docs a reference is made to the following caching policy:
Cache-Control: public, max-age=604800, immutable
This is also used in the default netlify.toml file. However, it seems to give me some problems. First of all, "604800" is a week, which is relatively short and therefore gives lighthouse errors (a common value is a year), nevertheless, the 'immutable' statement is also used. Newer browsers support this and basically tell to cache forever unless the filename has changed. This works fine for our css/javascript/images files that include a hash (integrity), but unfortunately it's not very useful for other files. The main problem is that when you change a post (.md) file, the resulting html does not have a hash and therefore is not changed. All your users will see the old post (with possible errors) unless they clear their cache. The same thing seems to apply to the search-index.json file. This file is also cached indefinitely and therefore does not show the newest results. Can we think of a solution for this? I for now removed the 'immutable' statement and went back to a more traditional caching policy which is not great for performance but at least checks if the file is changed.
Beta Was this translation helpful? Give feedback.
All reactions