Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

513
Views
Post Request CORS Error (Access-Control-Allow-Origin) en fetch api incluso agregué control de acceso en mi encabezado

Estoy tratando de publicar algunos datos en un servidor backend. pero cuando envío los datos, aparece el siguiente error: Recuperar en 'X' desde el origen 'localhost:8080' ha sido bloqueado por cors. Sin origen Access-Control-Allow en el encabezado.

Aunque tengo origen de permiso de control de acceso en el encabezado. El código se da a continuación:

 fetch(url, { mode: "cors", method: "POST", headers: { "Access-Control-Allow-Origin": "http://localhost:8080", "Access-Control-Allow-Credentials": "true", "Content-Type": "application/json", "API-Key": "xxxxxxxxxxxxxx", Accept: "application/json", }, body: JSON.stringify(data), }) .then((response) => response.json()) .then((data) => { console.log("Success:", data); }) .catch((error) => { console.error("Error:", error); });

Probé la política de no-cors, pero ese servidor no acepta solicitudes de no-cors.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

CORS se filtra y se maneja en el lado del servidor. Intente agregar hosts permitidos en la configuración del servidor, si tiene acceso. ¿Cuál es su marco de back-end?

O puede omitir CORS en Chrome usando --disable-web-security . Consulte aquí .

about 4 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 Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!