Cloudflare Worker: Image URL rewriting

Hi there,

I’ve been trying to setup a Cloudflare Worker to rewrite img src=“https://assets.ecommerce platform/uploads/images/product.jpg” to img src=“” without success : (

Any ideal on how I can do that? Any tutorial?

Tks so much!!!

Here’s a similar worker:

Tks so much Sdayman!

Just run a quick test on but got a 403 error. Any idea on what I’m doing wrong?

Seams that the Worker is changing the page url it self not the img address…

I use imgix, but only lower case urls and matching paths.

Add here the exact url client would vist and the imgix direct url.

Hi Adaptive,

Here it goes:
Exact url client would visit:

Imgix direct url:

Tks so much for your support!!!