Bypass cache when making a request via curl?

Is there a way to force a request to load an asset from the origin server? For example, I manage a non-cloudflare nginx caching reverse proxy server and if I send a request like this it will bypass the cache and load the file from the upstream server:

curl -H "bypasscache: 1" https://proxied.url/

This will result in a response with a header indicating that the cache was ignored:

X-Proxy-Cache: BYPASS

Is this possible with Cloudflare’s cache?

This is really useful when needing to troubleshoot an misbehaving asset on the origin server.

My original question stands (I’d still like to know if there is a way to bypass the cache by sending a special header in the request) but I did just remember a trick for skipping the cache: add a unique query string to the URL, e.g., https://proxied.url/?123456789. It’ll make the URL unique and load it fresh from the server.

Unless you have the Business plan and enable the bypass cache on cookie or do something custom on your own domain via Workers there is no way (for obvious reasons).

It can be configured so that isn’t the case, so unless it’s not your domain it’s not guaranteed.

Hi matteo, thanks for the reply.

It’s our domain, on a CF free plan.

How do I configure a domain so that unique URLs are not cached (you wrote, _ It can be configured so that isn’t the case_)?

I also noticed the cache is bypassed when sending a request containing a Authorization: Basic xxxxxxxxxxxxxxxx header. This seems to bypass the cache if it is the first request for the URL, but if the URL is already being cached, it continues to load from the cache.

There is a specific setting in the caching tab of the dashboard.

This seems standard behavior, the Authorization header doesn’t count for the cache. That’s why you need to issue specific Cache-Control headers for pages served to logged in users when rendered on the server.

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