We are also experiencing this issue. MIME type is configured correctly on our Origin servers. Requesting webp images should work fine, but whenever Cloudflare Image Resizer requests a webp image, it is setting the accept header to image/jpeg,image/png,image/gif;q=0.1 regardless of whatever the accept header is in the request.
Example:
Test request with accept header = text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
I have logging enabled on our Origin server and see the request from CF image resizer comes in to fetch the original image with accept header = image/jpeg,image/png,image/gif;q=0.1
You posted this question 24 hours ago on the Community and have received responses. I wouldn’t say that it’s “not important to CF”.
If others have not commented on this issue it’s possible that it’s only occuring for you, or only your specific setup. We can try and debug further but from the small snippet you’ve shown it is very hard to get a sense of how we can reproduce this issue.
I tried on different independent servers with IIS and its the same result when using Resize Image Server at CF. The accept header info dont include webp and therefore it throws a 406 error. Its with my own worker and with CF orignal worker /CDN-CGI/IMAGE. Also user “awhite1” are having the same issue suddenly. I have debugged it in my own Worker and its the fucntion
Reguest to the Origin server IIS
const imageRequest = new Request(imageURL, {
headers: request.headers //THIS ONLY INCLUDES the limited accept header, even if I console.log it on the dev site its correct.
})
When grabbing the orignal image at the origin server. Then the fetch function only sends image/jpeg,image/png,image/gif;q=0.1 regardless of the request header.
So the request is comming from CF with a wrong accept header.
Its like the Request Function sends its own header and not the orignal request header
Per the documentation you also need to include the cf: {image: {...}} property on the request from the Worker with any items you wish (such as format).
If someone have a simple setup where the Origin server are serving webp image files, and it works, it would be nice to see it works and what is different also when using the puclic CF worker.
Or if someone have a custom worker where it works, I could try that code.
Not sure if you saw my earlier comment, but @noerdar isn’t the only one experiencing this. As you can see from both of our earlier examples, this issue is not related to a bad request from a Cloudflare Worker. The issue occurs from both a Worker and if you just simply use the /cdn-cgi… url.
It should hopefully be simple to reproduce. Setup a webp image served from your Orgin server. Make a request to that image with a Cloudflare Image Resizer formatted url. CF hits the Origin server with the accept header of image/jpeg,image/png,image/gif;q=0.1. Seems very much like a bug on the Cloudflare side.