APO cache not working, cf-cache-status: DYNAMIC

Hey @eva2000, I would tend to say a HIT, but I didn’t perform the test.

It would essentially be like testing on an entirely different network. APO cache is working properly for all of my visitors, so I expect the result to be a HIT when using a VPN. I do not have a VPN available at the moment.

I’m sure @yevgen probably has an idea what’s going on :slight_smile:

At this point, it’s not really an urgent issue, but it does make testing a bit more tedious.

Since I activated APO yesterday:

  1. TTFB went up from 260ms to 1.1s.
  2. All my images stopped getting rendered through optimole CDN and instead loads the un-optimized images from the media gallery
  3. Cache is not working and the number of requests went up form 67 to 130

Seems everyone is facing a similar issue, wonder when cloudflare will fix this

please raise support ticket so we can look at the specific website you observe this issues.

I can’t reproduce the issue on my test environment. Please raise support ticket so we can look at your zone configuration. Please also specify in the ticket the list of cookie names you get when testing in the Guest browser and receive x-via: speedwp/origin,cookie header.

maybe add to WP plugin a diagnostic test button which can go through some tests/header checks and cache test and save to a log which can be provided to CF support ?

1 Like

Hi @yevgen, after performing morte tests, it seems like changing browsers is actually not important here.

The cf-cache-status header returns a HIT on the first page load after clearing cookies with x-via: speedwp/cache. Then, on subsequent page loads, the header returns DYNAMIC with x-via: speedwp/origin,cookie, regardless of the browser being used.

I see that there is a trc_cookie_storage cookie with “user-id”. Maybe this is triggering your regex that detects cookies to prevent cache when a user is logged in?

I will try to briefly disable Taboola which is adding this cookie to see if it resolves the issue.

That’s it @yevgen!

After removing Taboola, I got a HIT after multiple refreshes on ALL Guest browsers.

I suspect the trc_cookie_storage cookie with “user-id” is triggering APO’s bypass cache on cookie regex.

I would say this is a rather important issue because it means all returning visitors to all websites that use Taboola will get uncached content (DYNAMIC). Only first time visitors that have no trc_cookie_storage cookie set will get cached content (HIT).

If you need more help for troubleshooting, just let me know.

2 Likes

Can anyone please help me to fix the issue?

I disabled all the Page Rules, turned off the varnish cache from the server. Still, it’s showing cf-cache-status: DYNAMIC header.

@yevgen I have created a support ticket 6 days ago, no reply yet :frowning:

I just went ahead and tested your website insidebedroom.com and got cf-cache-status: HIT with x-via: speedwp/cache, which means cache is working just fine. You have a great 62ms TTFB from my office in Canada.

When testing, make sure you uncheck “Disable cache” under “Network” in Chrome Dev Tools. You might also need to quit the browser and open it again before you start seeing HIT. Also make sure to refresh at least two times. On the first try, you might get DYNAMIC if you just cleared the Cloudflare cache. You should get a HIT on the second try.

By the way, I’m using three Page Rules with APO and have no issues at all.

Cheers.

1 Like

@janvitos Thanks a lot for checking and letting me know. Yes, when I refreshed twice-thrice it’s showing HIT :+1:

Okay, I will turn on the Page Rules now. Thanks for letting me know.

The last question, I should keep varnish cache off from the server end, right?

I would definitely keep it. Why? Because each time Cloudflare needs to update your website’s cache from one of its multiple datacenters around the world, after a cache clear for example, it needs to make a roundtrip to your web server. If you don’t have a cache system on your server, these roundtrips will take much longer and will put more strain on your web server.

You also need to think about web crawlers and SEO. After a Cloudflare cache clear, a cached page will be generated after the first visit, but only for the visitor’s region. So if a Google crawler comes along and accesses the same page from a different region, Cloudflare’s datacenter from that region will access your web server again to pull the page. If you don’t have a cache system on your web server, that will be a lengthy trip for the crawler and might have an impact on your SEO score. The impact will most probably be minor, but you should always put the chances on your side.

In a perfect world, and I’m sure @yevgen would agree, Cloudflare would populate the cache from its own datacenters instead of making many lenghty roundtrips to web servers. So for example, Cloudflare could pull a web page from its New York datacenter to populate the cache in its London datacenter. This would mean less roundtrips to web servers and an almost instantaneous delivery of content all over the world. I would be curious to know if it’s something Cloudflare has already considered implementing. Maybe this is something covered by Argo?

1 Like

Now, I got it. Thanks a lot for the timely reply. I was worried about all this for the last couple of days.

1 Like

Yes this is part of Argo: https://www.cloudflare.com/products/argo-smart-routing/

  • Tiered Caching : Content served from adjacent data centers reduces cache-miss rates, server load, and end-to-end latency
2 Likes

Awesome. I guess I might consider getting Argo in the near future then.

On another note, should we expect a solution to the cookie problem in the coming days?

Thanks.

yes, we will rollout fix probably tomorrow.

2 Likes

Awesome. It’s always a pleasure to work with you.

Thanks.

The fix is live, please check.

1 Like

Great! Getting cf-cache-status: HIT in all Guest browsers now.

Thanks for the quick fix.

This issue is now resolved.

2 Likes

As i already posted, APO - No Cache Update on news site! cache still not getting purged automatically :confused: I ve to manually clear cache, when i change, update, edit a post. url is dimokratianews.gr

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