Worker as origin (i.e. behind cache)?

Hello,

Is it possible to configure a worker as an origin, so the worker sits behind the cache?

I’ve created a worker hosted on a subdomain (subdomain.domain.com) which generates a static html page. It works great, but every subsequent request needs to be processed again even though the end result is always the same html output.

Ideally I want the Cloudflare cache to sit in front of the worker, so after the first request is processed by the worker then the resulting html output is cached by Cloudflare so that subsequent visits can be served directly from the cache without needing to execute a worker.

So the flow would become:

Browser → subdomain.domain.com (Cloudflare cache) → worker.domain.com

Is this possible?

Thanks,

John

Using a pointer would be a nice approach, but there’s no way to set that up that would avoid Workers. I’m sure this is intentional for several reasons.
https://community.cloudflare.com/search?q=Worker%20behind%20cache

2 Likes