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

127
Vistas
Access to XMLHttpRequest at...... has been blocked by CORS policy

I know there are many responses about this issue but in my case I am running the server and the client side, I have changed the Access-Control-Allow-Origin in my header but still...

I have added the setHeader in my API response but I am still getting the same error. My app.post() is the next:

app.post("/api/todo", (req, res) => {
        Todos.create( req.body)
            .then(doc => {
                res.header("Access-Control-Allow-Origin", "*")
                res.status(200).json(doc);
            })
            .catch(() => {
                res.status(500).json({error: "Could not CREATE the Document"});
            })

I did the same one for a GET request and it worked, as I was facing the same problem before. In this case, with POST request, even though I added that line of code changing the response header I still get the same error.

Could anyone help ?

about 4 years ago · Juan Pablo Isaza
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