Cloudflare caching works perfectly fine when tested locally but doesn't work when deployed online

I am new to cloudflare. Can’t seem to solve the issue with caching, which works perfectly fine on localhost when I test it using the wrangler CLI but as soon as I switch to online testing or deploy to online worker the caching just stops and each subsequent request is loaded as fresh.

To see the worker please visit:

https://shoe-sensation-stg.zmags.workers.dev/?https://staging.shoesensation.com/rest/V1/products?searchCriteria[filter_groups][0][filters][0][field]=product_category&searchCriteria[filter_groups][0][filters][0][value]=%Converse%%26searchCriteria[filter_groups][0][filters][0][condition_type]=like&searchCriteria[page_size]=2&searchCriteria[filter_groups][0][filters][1][field]=season_code&searchCriteria[filter_groups][0][filters][1][value]=BTS23&searchCriteria[filter_groups][0][filters][2][field]=gl_code&searchCriteria[filter_groups][0][filters][2][value]=101

Source code can be found here
https://pastebin.com/0smaa8dc

Cache API only works/ever matches on Custom Domains, not Workers.dev

However, any Cache API operations in the Cloudflare Workers dashboard editor, Playground previews, and any *.workers.dev deployments will have no impact. For Workers fronted by Cloudflare Access, the Cache API is not currently available. Only Workers deployed to custom domains have access to functional cache operations.

1 Like

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