Working / Images Resizing

Hello, I have a few questions regarding cloudflare’s image resizing service. Basically as I understand it, there are two ways to resize images with cloudflare.

The first is to use their URL structure, when you use this method you get billed $10 per 100,000 resizes and each resize is cached so you only get billed once per resize.

My question is: what happens if a malicious user goes width=1, width=2, width=3 etc and generates millions of resizes? Is there any way to specify the image dimensions that are allowed?

The second way is to use your own custom URL structure and combine that with a worker. In that instance we can control the dimensions allowed which solves question #1.

My question is: using this method the image billing above applies as normal, i.e. we get billed per 100,000 image resizes and image resizes are cached and not re-processed everytime the worker gets called. I want to know if the worker output itself is actually cached, or we get billed everytime the URL gets called.

For example say we define the URL The first time this gets called the worker executes and the image resize executes and we get billed 1 time for each. The next time this URL gets called does the worker still execute (but not the image resize), or does the worker not execute because it knows to return the image it generated last time?


Just checking in to see if anyone had an answer for the question above?

AFAIK the worker will still execute, but image resize will not if the content is available in Cloudflare Cache. Using Page Rules you can setup Caching policies for the images so the worker won’t be executed.

@yevgen can you give please an exemple of page rule setup for preventing worker execution for resized images?
Thank you.