Only cache specific paths?

I have a web service where most endpoints are dynamic and real-time. However I would like to host the website for the service on the same domain, ideally at the root, and have it cached by CloudFlare, while all other paths are not. For example, I’d like example.com/index.html, example.com/bundle.js, and example.com/image.jpg to be cached, but nothing else. Failing that, it would also be acceptable for everything under example.com/site/ to be cached, and nothing else.

Are either of these possible?

You could use pagerules.

For example *domain.com/*
Cache Level: bypass

And another one like
*example.com/*.jpg
Cache Level: what ever fits your needs.

Another idea could be to put static content behind a sub domain or sub folder, let’ say ‘cdn’, and set the desired cache level for it with a page rule.

1 Like

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