• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

408
Views
ajuste cors en strapi 4

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', ];
almost 3 years ago · Juan Pablo Isaza
1 answers
Answer question

0

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', ];
almost 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error