Can't get CF transform via workers to do anything
Following this guide: https://developers.cloudflare.com/images/transform-images/transform-via-workers/#an-example-worker
Using an unbelievably basic worker:
This doesn't seem to do anything, it just sends the full size image through. What am I doing wrong?
Cloudflare Docs
Transform via Workers · Cloudflare Image Optimization docs
Using Cloudflare Workers to transform with a custom URL scheme gives you powerful programmatic control over every image request.
8 Replies
Do you have Image Resizing Enabled for the zone the worker is executing on under Image -> Transformations? If it's on workers.dev it'll never work. Also r2.dev urls aren't for production as they are rate-limited, Custom Domains are what you should use
I have it enabled for all zones
Sounds like the workers domain is the problem
are you running it on the workers.dev?
yeah
i cant figure out how to bind a domain to a worker
theres nothing in the worker settins
and nothing in the main workers config
where are domains configured? Surprised its this hard to find
oh its under triggers?
I find it odd and confusing the CF image behaviors dont work on the workers.dev domain
that seems like an easy solution
WOO using custom zone worked
It would be helpful to mention that you have to use custom zone in the docs
just because you can't allow it under the Image -> Transformations tab
You can add a Worker Custom Domain and it'll take care of the DNS, or routes and add a dns record yourself/add it over an existing origin (or on a specific path, etc)
Settings -> Triggers yea
a typescript example would be super helpful
the typing on this worker is a nightmare
the typing is all over the place in the CF lib
cool this is working great now, thanks for the info