How to set cache ttl for static assets with workers sites?

When i test my site with pagespeed, all the images have no cache ttl set.

how do i do it?

Is there any type of headers sections for those images in the Workers script? You can add this in with the other image headers:

      'cache-control': 'max-age=31536000',

where can i find it?

i just follow the tutorial to deploy a jekyll site https://developers.cloudflare.com/workers/sites/start-from-existing/

In dash.cloudflare.com, click on the Workers link in the right column and find your site’s script. Then click “Quick Edit” and comb through the code.

@sdayman or anybody else willing to answer: Does this apply only to Workers sites that have been deployed to something beyond the “.workers.dev” level — i.e., given custom domains? I’m just testing this stuff with a Hugo-created static site, similar to what @tuananh mentioned for a Jekyll site — except that the Hugo site already existed, so I used the 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 from 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).

Bump, bump. I would appreciate an answer to my question (#5 in this topic), even if it’s only to tell me to buzz off because this sort of thing isn’t for people without intimate knowledge of Workers sites. That, I would certainly understand. :slight_smile:

Finally got an answer, on Stack Overflow.