We would like to leverage Cloudflare’s cache for content that is access controlled on the origin.
We are planning to build a gateway in Cloudflare Workers that will validate a JWT token from our web application and based on that, allow/disallow the user to request the source content from the origin. The Cloudflare worker will have full access to the origin, with no access controls. (It’s just a object storage blob.) If the user is authenticated for access, we would like Cloudflare to cache the content for some period of time.
However, we’re unsure if:
- This will allow Cloudflare to cache the content whatsoever, or just break it completely.
- If the content is cached, is there a way for an unauthenticated user to read the Cloudflare cache directly without using the URL that forces them to the origin resource through our gateway?
Thanks for any help and guidance you can provide.