CDN
Since static files are served by the Flask app when usingurl_for('static'), you can enable the CDN setting to cache your static assets on Cloudflare.
To verify your static files are being cached correctly, request a file and inspect the response headers. The cf-cache-status header should be either HIT or MISS. MISS should only occur when the file needs to be set or updated in the CDN. HIT will be the expected value for most requests.
Edge Caching
If your app consists of mostly routes that don’t change often, then you can cache the rendered output of your pages with edge caching. This will apply to your entire app and only endpoints with headers disallowing caching will ignored by the edge cache. You can prevent caching by updating the route’s response to haveresponse.cache_control.no_store = True
response.cache_control.max_age to your desired value.
after_request decorator or creating your own decorator.
To verify your pages are being cached correctly, request a page and inspect the response headers. The cf-cache-status header should be either HIT or MISS. MISS should only occur when the page needs to be set or updated in the CDN. HIT will be the expected value for most requests.