Problem with Cloudflare Worker Image on specific Cloudflare data centers
We are starting to have problems with our Cloudflare worker which we are using to resize images.
The problem started for 16 hours ago.
In CPH if fails but in AMS it works.
To show the error I have created a super simple worker, see below
I have recorded a video showcasing the error
https://www.youtube.com/watch?v=PhmfZehZXcY
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
const getLastItem = thePath => thePath.substring(thePath.lastIndexOf('/') + 1)
async function handleRequest(request) {
let url = new URL(request.url)
let imageURL = "https://cloudflaretesting.blob.core.windows.net/assets/TESTCHPA0000.jpg";
let action = getLastItem(url.pathname);
let options = { cf: {
image: {
width: 200,
height: 200
},
}};
if (action == "resize") {
// https://assets.cdnlemu.dk/cloudflare/test/image/resize
// On some Cloudflare data centers gives:
// ERROR 9408: Could not fetch the image — the server returned HTTP error 400 Bad Request
return fetch(imageURL, options);
}
else {
//https://assets.cdnlemu.dk/cloudflare/test/image/
// Returns the image without image modifications
return fetch(imageURL);
}
}
The problem started for 16 hours ago.
In CPH if fails but in AMS it works.
To show the error I have created a super simple worker, see below
I have recorded a video showcasing the error
https://www.youtube.com/watch?v=PhmfZehZXcY
addEventListener("fetch", event => {
event.respondWith(handleRequest(event.request))
})
const getLastItem = thePath => thePath.substring(thePath.lastIndexOf('/') + 1)
async function handleRequest(request) {
let url = new URL(request.url)
let imageURL = "https://cloudflaretesting.blob.core.windows.net/assets/TESTCHPA0000.jpg";
let action = getLastItem(url.pathname);
let options = { cf: {
image: {
width: 200,
height: 200
},
}};
if (action == "resize") {
// https://assets.cdnlemu.dk/cloudflare/test/image/resize
// On some Cloudflare data centers gives:
// ERROR 9408: Could not fetch the image — the server returned HTTP error 400 Bad Request
return fetch(imageURL, options);
}
else {
//https://assets.cdnlemu.dk/cloudflare/test/image/
// Returns the image without image modifications
return fetch(imageURL);
}
}
YouTubeChristian Palm
Source code: https://gist.github.com/lm-chpa/c2cc08ba039628326cda2fa86e213df8
https://assets.cdnlemu.dk/cloudflare/test/image/resize
On some Cloudflare data centers gives:
ERROR 9408: Could not fetch the image — the server returned HTTP error 400 Bad Request
https://assets.cdnlemu.dk/cloudflare/test/image/
Returns the image without image modif...
https://assets.cdnlemu.dk/cloudflare/test/image/resize
On some Cloudflare data centers gives:
ERROR 9408: Could not fetch the image — the server returned HTTP error 400 Bad Request
https://assets.cdnlemu.dk/cloudflare/test/image/
Returns the image without image modif...

