Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

171
Vistas
How to bypass CORS in ajax call in your localhost when working with Fetch API?

I have been unable to make a successful call to a URL endpoint due to CORS issues. When I installed a CORS chrome extension, the request went through and returned a valid response with no issues. This is the code below and how can I bypass this CORS error?

     const url="http://staging1...";
     let data = { 'encrypted request payload'};
     let fetchData = {
     method:'POST',
     body: data,
     headers: new Headers({'Content-Type':'application/json'})
   }

  fetch(url, fetchData)
  .then(function(response)){
  console.log(response);
 }

The response from the above code

Fetch API cannot load http://staging1.... Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.

over 4 years ago · Santiago Trujillo
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda