I believe you'd need to port your CDN code when moving on any of those platforms though. You might get away without re-architecting anything else.
You can write JavaScript that runs just fine on both fly.io and Cloud Flare workers. We both target the in browser Service Worker API. We actually have a few users that deploy the same code to us + Cloud Flare, and use our runtime for local testing + CI: https://github.com/superfly/fly
CDNs are commodity so it's really the extra features that cause companies to move. With something like Workers that allow you to build whatever functionality you want, it actually reduces reasons to move in the first place. Also CF doesnt charge for bandwidth which is a unique advantage.
We have a serverless product that is very similar to Workers. Our global footprint can handle 65tbts and we also do distributed containers and VMs at the edge. We also don’t require users to use our DNS.
Can you shoot me an email? ben.gabler (at) stackpath (dot) com
And if you decide to move from Cloudflare to another major CDN provider, you will have to change how your product works?
Because that's what StackOverflow and Reddit did. They are not using Cloudflare anymore.
So, does using Cloudflare Workers create a serious vendor lock-in, that makes changing a CDN provider much more costly in the future?
EDIT: I am thinking primarily about Fastly, as it's where the majority of large players move from Cloudflare. Also, about KeyCDN, which can be a much more cost-efficient alternative to the Cloudflare's Enterprise plan.