In order to add “stale-while-revalidate” and/or “stale-if-error” to the Cache-Control header, you must choose “Custom” in the dropdown rather than “Set”. You can then for example enter the following:
“private, max-age:604800, stale-while-revalidate=604800, stale-if-error=604800”
Are you suggesting that it would make sense to add these automatically when “private” is set? Should it then be the same number as max-age? Would that make sense? (I haven’t read up on these options)
Ah ok, I completely misunderstood the whole thing. To be honest, I didn’t know about these options until your plugin provided that link. The tool tip says it’s a good idea to set it. Maybe it’s best to provide dropdowns for these two settings so the first box doesn’t have the custom option.
I actually wonder if I should set this. I use WP Fastest Cache and that adds browser caching rules to htaccess, like
ExpiresByType image/webp A10368000
Or is that a different cache?
I did not know the ExpiresByType directive. It is a funny one, because it controls both the Expires header and the Cache-Control header. The Cache-Control header is preferred to the Expires header and browsers that supports the Cache-Control header (all modern browsers) ignores the Expires header. So it is only usable for older browsers and to satisfy some tools, like gtmetrix.
But the ExpiresByType is interesting because it is part of the “mod_expires” module rather than mod_headers. So it seems to be a way to set the Cache-Control header that does not require mod_headers. However, as the ExpiresByType does not allow setting stuff like “private” or “stale-if-error”, it seems that it can not set anything interesting in the Cache-Control header and is usable only for setting Expires header, which as I mentioned isn’t that valuable. But I guess it is a small improvement to do so, in addition to the Cache-Control header – for the sake of old browsers and stubborn performance analyzers.
-
This reply was modified 7 years, 1 month ago by
rosell.dk.
Thanks and wow, a lot of info to process :/
yeah, but the good news is that it doesn’t matter much 😉