Cache expiration control check

From my reading on cache timeouts, I had the impression that they could be set by s-maxage=31536001 in the header.

And that a page rule that applies with Edge Cache TTL:a month would override that. That, even if the header shows s-maxage=31536001, Cloudflare will actually be using the rule setting.

Caching level: standard.
ondogbehavior.com/*
Browser Cache TTL: 2 hours, Cache Level: Cache Everything, Edge Cache TTL: a month

Last evening, 17 pages showed cf-cache-status:HIT.
The next morning, 4 pages showed MISS, and 13 pages EXPIRED.
Running my script a 2nd time, now they are all HITs, so that’s working okay.

It appears that one-of Bluehost, WP Super Cache, or Cloudflare is expiring only some of that cache. As it took overnight, this may take some time to ring out.

My question here: Is my understanding of Cloudflare caching correct?

Do you have Cache-control HTTP header setup on your origin?
Moreover, are you using “Respect existing headers” option for Browser Cache TTL in Cloudflare dashboard or some other option available from the dropdown select? Because, it can overwrite your settings, or setup the correct one as choosen.

Could be due to other Cache-control, ETag, Pragma, etc. headers.
Moreover, if using Last-modified, and if some of it are having different values depending if you have updated some content and the WP Super cache re-generated the .html, and the Cloudflare edge does not have “the new one”, it could be that difference as I suppose.

The “Respect existing headers” is only for browser cache ttl, but it is set.
I don’t see Pragma, ETag, expire or anything like that in the headers.

The doc says it will honor headers, unless there is a matching page rule which includes an Edge Cache TT:, which will then overrides the header value.

Testing:

Setting Edge Cache TTL:two hours in page rules DID expire the cache in two hours, so that is working.

With Edge Cache TTL:one month, and s_maxage=240, the cache DID expire in 240s, EVEN THOUGH Cloudflare doc says the page rule should override!

With Edge Cache TTL then removed from the page rule, s_maxage=240 DID expire in 240 s, as expected.

Trying:

From there on, I used only s_maxage to control cache expiration.

With s_maxage set to one year, half the cache is gone in about 20 hours or less.

Maybe there’s some time limit that brings up a default?

With s_maxage set to one week, half the cache is still gone overnight.

It appears this may happen with Wordpress when using a caching plugin that recognizes Cloudflare, but NOT including the Wordpress Cloudflare plugin. Everything will seem fine, with no log errors, but some cache loads will be slower and expirations may happen overnight.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.