Hello everyone.
I’ve been trying to figure out how to get APO to refresh its caches automatically without an API or a manual purge by URL. I’ve been through documentation, the forums, and whatnot and have not found any way to make it refresh “on time”.
Have I misunderstood what triggers cache clearing? Does it always need to come as a request from the WordPress plugin via API?
Current settings on Cloudflare:
- Plan: Free
- Caching level: Standard
- Browser Cache TTL: Respect existing headers
- APO: Enabled (Cache by device type: Disabled)
Below are a few examples of cURL requests trying various scenarios and header combinations at the origin.
Example 1
No max-age or s-max-age instructions are sent, only last-modified and expires. The date
response header has passed the indicated expires
time and yet APO has not refreshed the cache.
curl -sv -o /dev/null https://theatrum.ro/program-teatru-bucuresti/ -H 'Accept: text/html'
> GET /program-teatru-bucuresti/ HTTP/2
> Host: theatrum.ro
> user-agent: curl/7.79.1
> accept: text/html
>
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 200
< date: Wed, 27 Apr 2022 13:10:33 GMT
< content-type: text/html; charset=UTF-8
< cf-ray: 7027cc885fb16d7d-MUC
< age: 408
< cache-control: public, no-cache, must-revalidate
< expires: Wed, 27 Apr 2022 13:06:44 GMT
< last-modified: Wed, 27 Apr 2022 13:03:44 GMT
< link: <https://theatrum.ro/?p=4076819>; rel=shortlink
< vary: Accept-Encoding
< cf-cache-status: HIT
< cf-apo-via: tcache
< cf-edge-cache: cache,platform=wordpress
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< x-turbo-charged-by: LiteSpeed
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=lzoGGR56mujm7d1nU4CCo79O3EYO%2BZyQU2Wc24daqexxUlGsAgPzyMuOWHo1OS%2F5csquzc%2BlFZqib3KJJmYmtl8XK7B%2BdoTnRx0UJCKVDrrqa4T9dRxD7Up5TCiYtg%3D%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Example 2
max-age
of 12 hours yet the content served is almost 3 days old. Expires likewise didn’t help.
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 200
< date: Tue, 26 Apr 2022 16:21:58 GMT
< content-type: text/html; charset=UTF-8
< cf-ray: 7020a7896e2768f2-FRA
< age: 250658
< cache-control: public, max-age=43200, stale-while-revalidate=3600, stale-if-error=43200
< expires: Sun, 24 Apr 2022 00:00:00 GMT
< last-modified: Sat, 23 Apr 2022 00:00:00 GMT
< link: <https://theatrum.ro/?p=3711393>; rel=shortlink
< vary: Accept-Encoding
< cf-cache-status: HIT
< cf-apo-via: tcache
< cf-edge-cache: cache,platform=wordpress
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< x-turbo-charged-by: LiteSpeed
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=iwtYSSWnahHnGYq58CTU3T5koeGJZ9qQOe3IZapLQDGZhDDKdXaXPeZzSQ%2B1ePkvYzD1Yme9xMWTbcep1lN9N%2Bgi%2FWjxeCi%2FmZWv3pSSlQssdOfxfS%2F4%2BdM42Ewpcw%3D%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Example 3
Same URL as Example 2 above, max-age
of 12 hours yet the content served is almost 5 days old. Requests behind Examples 2 and 3 have been run within a minute of each other for the exact same URL, from the same source IP, reached the same CF datacenter. What’s going on, why do I get a response varying between 3 and 5 days old?
* Connection state changed (MAX_CONCURRENT_STREAMS == 256)!
< HTTP/2 200
< date: Tue, 26 Apr 2022 16:22:08 GMT
< content-type: text/html; charset=UTF-8
< cf-ray: 7020a7aa7ec39ba1-FRA
< age: 401351
< cache-control: public, max-age=43200, stale-while-revalidate=3600, stale-if-error=43200
< expires: Thu, 21 Apr 2022 00:00:00 GMT
< last-modified: Wed, 20 Apr 2022 00:00:00 GMT
< link: <https://theatrum.ro/?p=3711393>; rel=shortlink
< vary: Accept-Encoding
< cf-cache-status: HIT
< cf-apo-via: tcache
< cf-edge-cache: cache,platform=wordpress
< expect-ct: max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"
< x-turbo-charged-by: LiteSpeed
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=MUKOmHoE9Tm73Fj7Q8OZ%2FQNJT5a2mAMPviDHeHffBrTNePf1azdV2lp0fpc%2FkvTVR7bsUbVWUFJl6CTFyoyZPWr7ObKxSWU4cusLTQWpRFWJ3aLbNAzREbgL64Z3zQ%3D%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< server: cloudflare
< alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400
Thanks in advance for your support.