.csv is cached despite page rule

I have a page Rule on a url example.com/*.csv that sets Cache Level to Bypass.

However when I call my endpoint with a .csv at the end it still caches every call succeeding the first call.

When I call without the .csv, it then works as expected (hits my server) every time

Is there anyway to make sure calling with .csv at the end of URL will not return a cache result?


Did you purge the cache after creating the page rule?

I did purge all cache. But still no luck.

Found the issue.

We had the following in our worker:

request = new Request(event.request);
var response = await fetch(source, request);

fetch was caching but this was not appearing on the CloudFlare Caching Status dashboard nor we were getting a CF-Cache-status header back which all indicated that no caching was taking place on the CloudFlare. It was quite baffling.

Setting the cache ttl to 0 solved the issue:

request = new Request(event.request, {cf: {cacheTtl: 0}});
var response = await fetch(source, request);

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