CORS blocked on mobile device when uploading image from camera

I have a file input for uploading images which is working great on desktop but I am having an issue with mobile.

<input type="file" class="customerImage" id="customerImage" name="myfile" accept="image/*">

If I choose a previously taken photo from my mobile gallery then the fetch request works nicely and all is good.

However an issue arises if I use my camera to take an image directly. On mobile I will click the ‘Choose file’ button where I am prompted to choose an existing image or ‘Camera’ which opens my camera to take a new image.

If I take a new image and try to upload it, then I am getting blocked by CORS

Access to fetch at ‘’ from origin ‘’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.

I am using a Xiaomi Redmi Note 7 on Android and the bug is consistent across multiple browsers, but I do not have another mobile device to test with.

Anyone have any clues on why CORS is blocking my request when I am trying to POST with an image from my camera, when it works fine sending a POST with an image from my phone storage?

Can we assume you have checked the server access-control headers?

I am not sure if it is some aspect of CORS that I don’t understand, or simply bad server configuration, but sometimes I’ve seen CORS error with a bad request (I would expect 4xx error), even if server tells browser that COR are allowed.
Something you can check - when you take a photo, what is the camera output? jpg? Perhaps you are sending binary blob with MIME type image.

More info from browser devtools’ request tab might help to solve this.

These should be fine. It works with any other request and image. Only fails upon taking a new image directly with the camera.

A regular photo taken is a .jpg but when being prompted to open the camera to take a photo to upload, the image is not saved on my phone so I cannot confirm the file type.

I had a look at this but there are no differences in the request headers, and both send
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryRcs4bIDL7hveakwS