I write a rule snippet that would rewirte the query part of the URL to resize the image to a path part that uses Cloudflare built-in image resizing worker. This snippet works in the snippet editor, but failed in the broswer in the real world.
Or, alternatively, if you change “?x-oss-process=” to something else, such as e.g. “?x-oss-processs=” (note the extra “s”), it would work too.
Mind if I ask how exactly you ended up with the code you shared?
What lead you to use stuff like e.g. "newURL.search.includes" and “newURL.search.split”?
What lead you to set the response variable to the await fetch(), and then “return response;”?
→ If you simply do “return await fetch(newURL);”, does that make a difference?
When I am playing around with the code provided (setting “request.url” to the URL you provided), then at least the ELSE IF is producing a link, that generally seems to be working fine (when queried directly).
For a brief moment though, the “/cdn-cgi/image/fit” link you’re fetching from, were returning 403 Forbidden, with the text “Strange.” in the response body.