• Hi,

    I have been looking at the ‘Cache-Control header’ settings and set it to private, one week. Shouldn’t that add the ‘stale-while-revalidate’ + ‘stale-if-error’ rule into the /wp-content/.htaccess file?

    If I check it, it only contains this. Even after using the [Save settings and force new .htaccess rule] button

    <IfModule mod_headers.c>
    <FilesMatch “\.webp$”>
    Header set Cache-Control “private, max-age=604800”
    </FilesMatch>
    </IfModule>

    Thanks
    JP

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author rosell.dk

    (@roselldk)

    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”

    Plugin Author rosell.dk

    (@roselldk)

    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?

    Plugin Author rosell.dk

    (@roselldk)

    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 :/

    Plugin Author rosell.dk

    (@roselldk)

    yeah, but the good news is that it doesn’t matter much 😉

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Where is the Cache-Control header set’ is closed to new replies.