How to cache worker response?
I want to cache worker response, so that when the next request comes in, there will be no worker invocation.
7 Replies
Workers run in front of cache, worker would still always be invocated
@Chaika So, the worker will always be invocated even if I have set up a cache rule for the worker route, right?
yes
is there a default cache setting for my worker if i set a custom domain (my cf domain) to my worker?
no, any cache behavior in your worker would have to be manually done with Cache API
anything it fetches though would be using the default cache behavior: https://developers.cloudflare.com/cache/concepts/default-cache-behavior/
Cloudflare Docs
Default cache behavior | Cloudflare Cache (CDN) docs
Cloudflare respects the origin web server’s cache headers in the following order unless an Edge Cache TTL cache rule overrides the headers. Refer to the Edge TTL section for details on default TTL behavior.
i see, thank you!