Cloudflare is serving cache API responses to returning users and not to new users

What is the name of the domain?

https://cartobikes.online

What is the issue you’re encountering

Cloudflare is only serving cache API responses to returning users and not to new users

What steps have you taken to resolve the issue?

I am facing an issue with my Cloudflare cache settings for an API endpoint. Despite configuring my Cloudflare page rules to cache content, the responses aren’t being served from the cache to new users, as expected. Below are the details of my current setup:

Cloudflare Page Rule Settings:

Incoming Request Matching: Custom filter expression
Cache Eligibility: Eligible for cache
Edge TTL: Use cache-control header if present, bypass cache if not
Browser TTL: Respect origin TTL
Cache Key Settings:
Cache deception armor: Disabled
Cache by device type: Disabled
Ignore query string: Disabled
Sort query string: Enabled
Serve Stale Content While Revalidating: Enabled
Do not serve stale content while updating: Disabled
Respect Strong ETags: Not selected
Origin Error Page Pass-through: Not selected
Placement: First rule
API Response Headers:

Cache-Control: max-age=300, public, s-maxage=600

I expected the API response to be cached at Cloudflare’s edge for the specified TTL, yet the data isn’t consistently served from cache. Is there something incorrect in my configuration, or might I be missing an additional setting? Any guidance on why the API response might not be caching as expected would be greatly appreciated.

This topic was automatically closed after 15 days. New replies are no longer allowed.