Will edge cache break my dynamic web site/app?

I want to implement EDGE CACHE so that my static files (specially images) are cached on the CF servers for all succeeding website visitors , for speed and bandwidth savings on origin server.

but I’m confused with the definition:
" Specify how long to cache a resource in the Cloudflare edge network. Edge Cache TTL only takes effect when included as a setting in a Page Rule that also sets Cache Level to Cache Everything . Edge Cache TTL isn’t visible in response headers. The minimum Edge Cache TTL depends on plan type:"

This seems to imply that I have to set CACHE LEVEL to CACHE ALL instead of STANDARD…

That means everything’s gonna get cached… images, php pages, php/api responses, jsons, etc… right?

So that means this has the potential to break my site? specially with form submissions… the submitted data to the api is as follows

URL: domain.com/api.php?save=1&user_id=1
{form data inside POST}

if success, api responds with “ok”
else, “error”

So if i understand this correctly, the first time a user successfully submits data and get’s the “ok” from the origin server, CF will then save this response under the url definition:

domain.com/api.php?save=1&user_id=1

Thus next time someone submits data to the api, even if it’s wrong, CF will still present the cached “ok” response to the browser…

Right?

These and other very similar concerns are what im worried about.

And if so, is there a way to take advantage of edge cache w/o caching everything?!

You don’t need to implement anything other than standard :orange: Proxy mode to edge cache images and other static files. Dynamic data (PHP and actual HTML source) isn’t included by default.

https://support.cloudflare.com/hc/en-us/articles/200172516#h_51422705-42d0-450d-8eb1-5321dcadb5bc

1 Like

So, i dont need Edge Cache settings to make sure CF serves cached content to website visitors from the same location? I kinda had the impression that if this edge thing was NOT set, CF will serve fresh content to every single user (browser) on first visit and then serve cache content on repeat visits of that same user (browser)

You shouldn’t need to make any special changes to the default values.

Each edge location has a few caches, and they’re independent. So later visitors in that locality will hit the cache, but only for a limited time, like a few days max unless there’s constant traffic through that node.

I see

anyway I asked because my host (origin server) is getting huge bandwidth and CF is onily caching half of the traffic (w/c is mostly jpg files)

will establishing edge cache ttl help?

Do you have a Pro plan or higher?

If yes, you can actually check the Cache Analytics and see what’s not cached by Cloudflare.

unfortunately im just on FREE plan

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