Unable to resize image from Workers


We are having issues getting Image resizing to work as expected in a Worker.

We are on Business - which I know is needed for image resizing.

We can use the cdn-cgi/image/ method directly from a browser, but not in a worker. We cannot get the examples in the documentation to worth either.

To test it I copied the exact example from the documentation (https://developers.cloudflare.com/images/worker/) and it does not resize the image, but it does return the original image at its original size.

The Workers themselves all return as expected, we can add headers to images and do sub-requests for images etc. We just can’t get the images to resize from a worker.

Any suggestions?

Is the worker running on the same domain that have Business upgrade?

Thanks for the question @thomas4 - the Worker was running on the same domain. However, it prompted me to set up a new site on a subdomain to test - and everything is working there. My conclusion is that some redirect rules on the main domain origin was messing with the Worker sub requests.


1 Like

Yeah, redirects can be difficult to debug since you’re doing the resizing directly.

Glad you found out the reason :slight_smile:

Just wasted 2 hours to find out that I need the business instead of the pro plan to enable the image resizing. The behavior of serving the original image without any further error message / header is really confusing, if you just try to get started. This limitation is also not mentioned here (https://developers.cloudflare.com/images/worker/) at all.

I’ve pointed this out to CF before, maybe they will fix it sometime.

I’ve also tried to convince CF here (https://twitter.com/webermaximilian/status/1266388734947266561?s=19) but no success :joy: