Estoy usando strapi 4 como localhost y tengo un problema con la configuración de cors cuando agrego nuevos activos a través de url
La carga de imágenes toma un error de CORS Access to XMLHttpRequest at 'https://www.countrysideveterinaryclinic.org/sites/default/files/interesting-cat-facts.jpg' from origin 'http://localhost:1337' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
La solución de aquí no ayudó
mi middleware.js
module.exports = [ 'strapi::errors', 'strapi::security', 'strapi::poweredBy', { name: 'strapi::cors', config: { enabled: true, header: '*', origin: ['http://localhost:1337'] } }, 'strapi::logger', 'strapi::query', 'strapi::body', 'strapi::session', 'strapi::favicon', 'strapi::public', ];
Encontré la solución yo mismo, tal vez ayude a alguien.
middlewares.js
module.exports = [ 'strapi::errors', 'strapi::security', 'strapi::poweredBy', { name: 'strapi::cors', config: { enabled: true, headers: '*', origin: ['http://localhost:1337', 'http://example2'] } }, 'strapi::logger', 'strapi::query', 'strapi::body', 'strapi::session', 'strapi::favicon', 'strapi::public', ];