Does enabling Edge Cache TTL make CloudFlare ignore origin's cache header?

wordpress

#1

Greetings,

I decreased a customer’s response time to 30ms by configuring the “Edge Cache TTL” but it won’t respect any caching header. As I understand (definily I can be wrong) TTL should be the “Maximum Time To Live” not the “Exact Time To Live”, enabling this settings made CloudFlare’s edge location cache the admin bar on some pages (when an authenticated admin is the first person to visit it), even when Cache-Control is set to “private” or “no-cache” and Expires is set to “0” or “-1”.

So I disabled this setting and the response time now ranges between 30ms (when requesting a URL by the second time under 5 seconds after the previous request) and 1.5s (when it goes to the origin - yes, the server is really far… but the customer won’t move it, I am unable to understand why - And it happens quite often) .

Is it the intended behaviour? If it is, is getting the business plan the only way to keep a more persistent cache on the edge location without showing the WordPress’ admin bar to anonymous visitors?


#2

Hi Rafael, welcome to the Community! You should set to Respect Existing Headers the Browser Cache Expiration option in the Cache page and then control all other parameters via the headers (I do it like that and everything seems fine, it’s way easier to do and doesn’t require the need for Page Rules).

Here there is a list of all possible values with an help to configure things, if you have specific requests just ask, I’ll try to help as much as possible:


Is it possible that the server takes a lot of time building pages? Have you added caching plugins to Wordpress?


The Business plan allows to bypass cache on cookie, which helps obviously, plus it gives less quicker than needed cache expirations due to size and low-usage limits (never actually tried it, though).


#3

Thank you for the answer.

You should set to Respect Existing Headers

That’s what I am doing know. I was just trying to figure out why I get so many more cache misses when using this option in comparison with defining the Edge Cache TTL. It looks like CloudFlare is constantly clearing the Edge Cache without this option, maybe some kind of storage management?

Is it possible that the server takes a lot of time building pages? Have you added caching plugins to Wordpress?

The server serves static HTML generated by WP Super Cache directly from disk. 1.5s is the maximum I got, averages around 500-600ms (from Brazil, server is somewhere in Europe - I just handle the software setting for this specific client);

They are quite happy with the response time, it’s just my technician’s OCD.


#4

I really do not know, it could be, but no idea. I have actually never used that setting :sweat_smile:

That average is not that bad for such a distance, given a bit of time lost fetching and returning the file. It could be better though. Actual direct ping to EU from Sao Paulo is ~200/250ms, but will vary depending on the server’s location.


#5

I wonder if it isn’t a case of Cloudflare clearing the cache, but
rather, re-validating? Revalidation doesn’t re-download the entire
content from the origin server but it does require a response.

What do your Cache-Control headers look like?