I'm just testing Workers sites with a Hugo-created static site. It already existed, so I used the docs’ instructions for adapting an existing site. The cache-control
headers for the woff2
and css
files all show up with no-cache
, contrary to what I'd have expected based on https://support.cloudflare.com/hc/en-us/articles/200172516#h_a01982d4-d5b6-4744-bb9b-a71da62c160a. The Workers site in question is https://hosts-test-hugo.brycewray.workers.dev/.
I found the following at https://levelup.gitconnected.com/use-cloudflare-javascript-workers-to-deploy-you-static-generated-site-ssg-1c518e078646 but don't know if it's related:
A Cloudflare Worker is a piece of JavaScript code that runs every time you access a specific route on a website proxied by Cloudflare. The code is executed on every request before they reach Cloudflare’s cache. This means Worker responses are not cached (although requests made by the worker to other web services might be cached with the appropriate caching headers).
Does the site need to have a custom domain — i.e., rather than being a “.workers.dev” URL — before it will have normal caching behavior? Is that even related?
[Note: I am posting this here because I’ve been unsuccessful in getting a response on either the Cloudflare community forum or the Cloudflare subreddit — hoping for better results here.]
cache-control: no-cache
on any of the responses I get back. The css and woff2 files in particular don't seem to have a cache-control header at all, but the cf-cache-status shows they are being cached by Cloudflare. In what context are you seeingno-cache
?cache-control
header under Response Headers. I see similar results on other sites I know to be Workers Sites. However: I now, after many hours of additional searching than I'd already done, am finding more information (in and out of the CF site) that explains this better. Thanks for responding, sir.