CORS error when sending many post requests using a loop in React

System Information
  • Strapi Version: 3.6.3
  • Operating System:
  • Database:
  • Node Version:
  • NPM Version:
  • Yarn Version:


When I’m using a loop to send many post requests in production, then some of them will give this error:
Access to XMLHttpRequest at '' from origin '' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

Others will be successful. I have CORS origin in strapi config and I can send post requests, but when using a loop then sometimes it fails.

for(let i = 0; i < file.length; i++){
const data = {
    name: file[i]["Name"],
    number: file[i]["Number"],
    category: category[0].value,

let productPhotoFromFile = Array.from(productPhotos).filter(obj => {
    return === file[i]["Photo"];

const formData = new FormData();

if (productPhotoFromFile.length > 0) {
    formData.append("", productPhotoFromFile[0].originFileObj);
} else {
    const blob = await (await fetch(unknownPhoto)).blob();
    formData.append("", blob);
formData.append("data", JSON.stringify(data));
try {
    await + '/items', formData, {withCredentials: true});
} catch (error) {

I can’t see anything in Strapi console and on localhost I don’t have this problem. Can’t understand what is causing this?