Image Transforms on pages

I have a pages project with an image transform endpoint.

As far as I can tell, I can't use Cloudflare's image transform features because the pages function isn't running in the same zone as my website's zone. I assume this is because Custom Domains in Pages are really just DNS record aliases - it's not moving the function to run in the Cloudflare zone where Images is enabled. For presumably the same reasons,
wrangler.toml
's routes option doesn't work either (Configuration file for Pages projects does not support "routes").

I still want to have an entire website running, but I want 1 API endpoint which optimises images dynamically.

What's the best way to solve this? For example, do I need to mix and match a separate worker just for the image resize and a pages project for everything else?

- pages.dev: https://fast-images.pages.dev/
- deployment ID: 5839679a
- account ID: a743ed06cad7fe7565e231b80cb268b2
- zone ID (for images): 539e268afac9443cf7dc601b8e8e599d
Was this page helpful?