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

123
Views
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
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!