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

382
Views
Access to XMLHttpRequest at from origin has been blocked by CORS : The 'Access-Control-Allow-Origin' header contains multiple values '*, *', react

We have deployed our API's on amazon ec2 and we are using these API's on our frontend react.js. We already have set the headers 'Access-Control-Allow-Origin' to '*' in backend

// Preflight API
static setPreflight = async () => {

    const config = {
        headers: {
            'Authorization': `Bearer ${sessionStorage.getItem('authData')}`
        }
    }
    await axios.options(`http://-------/preflight`, config)
}

when we call this function only once to set headers for preflight but we got this error

Access to XMLHttpRequest at 'http://ec2-13-125-149-247--------/preflight' from origin 'http://localhost:3000' has been blocked by CORS policy: The 'Access-Control-Allow-Origin' header contains multiple values '*, *', but only one is allowed.

enter image description here

How to resolve this type of error on react.js?

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!