The context is I have a CNAME record, foo.com to map to bar.com. And we would like to separate the static files hosting from bar.com to s3.
By using page rules, we cache everything for foo.com for 5 minutes.
I was suggested that worker can play the role to match the subpath to serve static files. like for any url pattern foo.com/static/*, use worker to fetch assets from s3, and cache it using cache api. But as we experiment, the number of requests for this worker is huge. I'm guessing it's because worker code has to run every time a user downloads static file, no matter it is cached or not, because it needs to go through worker to interact with cache. The cache protected s3 not to be fetched frequently, but cannot stop worker from running every time a user requests a static file.
Is using worker to serve static files a good idea? or I should look into other approaches?