This was added to prevent browser cache from causing problems. Visitors who have previously visited the site cannot see the most recently published posts.
Thread Starter
Manoa
(@manoaratefy)
Thank you for your clarification.
Do WP Fastest Cache has any feature to control server-cache expiration time? Like an option to enable, and it adds X-Cdn-Expires header or something like that?
are you using Varnish Cache?
Thread Starter
Manoa
(@manoaratefy)
Yes, I’m using mainly Varnish cache, but I’m asking this question for all server-side page caching like Varnish, also Nginx proxy cache, Cloudflare’s page caching, and any other HTTP caching.
yes but I added it because we had lots of problem about the browser caching.
I recommend you to add Varnish Cache integration and set a cache timeout rule.
Thread Starter
Manoa
(@manoaratefy)
Enabling Varnish Cache integration only enables cleaning mechanism. It doesn’t make really sense to enable the Varnish Cache integration to clean cache if there’s nothing to clean.
For now, I tagged all .html pages cached by WP Fastest Cache with an header on my VirtualHost:
<Directory ~ "wp\-content\/cache\/all(\/.*)*\/index\.html$">
Header set X-Varnish-Platform "wpfastestcache"
</Directory>
Then, I bypass the default built-in VCL in Varnish:
sub vcl_backend_response {
if (beresp.ttl < 86400s && beresp.http.Content-Type ~ "text/html" && beresp.http.X-Varnish-Platform ~ "wpfastestcache") {
set beresp.ttl = 86400s;
set beresp.grace = 86400s;
return(deliver);
}
}
So it is forcing Varnish to cache page for 1 day (86400 sec) if response Content-Type is text/html and if it is tagged with the header X-Varnish-Platform (so, it is not caching anything that is not cached by WP Fastest Cache, making it to follow all exclusion rules implemented in WP Fastest Cache settings).
However, a proper implementation would be very welcome. The cache timeout settings itself could be served as custom header response on cached HTML pages so any server-side caching system can catch and use it.