Apply Cloudflare Auto-Minify for Worker requests that return R2 html, js, and png files

I've turned on auto-minify on cloudflare and cleared the cache, but I don't see Cloudflare applying any auto-minifying to my pages. The flow currently is client request -> worker -> r2 file. It seems like this bypasses the Auto-Minify logic layer. Is there a way to enable this?
6 Replies
Erisa
Erisa2y ago
Auto minify only applies to cached assets, are you implementing the Cache API in the Worker?
cake
cakeOP2y ago
I'm not. I'm getting the data from R2 and returning directly. Is there a way to do what you are talking about with R2?
Erisa
Erisa2y ago
Use the Cache API · Cloudflare R2 docs
Use the Cache API to store R2 objects in Cloudflare’s cache.
cake
cakeOP2y ago
this is a free api to use, right?
cake
cakeOP2y ago
Will this also work with the Polish feature?
Erisa
Erisa2y ago
Yes and yes Cache API is a way to programatically interact with the regular zone CDN cache, which is completely free
Want results from more Discord servers?
Add your server