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

201
Views
Why is CORS reporting my HTTP status is not ok?

I'm using https://add0n.com/access-control.html in order to bypass the CORS policy for an extension I'm making, however, I'm receiving this error:

Access to XMLHttpRequest at 'https://myexampleapi.com/' from origin 'https://www.somedomain.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: It does not have HTTP ok status.

This is the code I'm using to access the API is:

var xmlHttp = new XMLHttpRequest();
xmlHttp.open("GET", 'https://api.example.com/test/getstats?userId=76561399568194663', true);
xmlHttp.setRequestHeader("ApiKey", "13cf02fb-fake-442f-f7cc-9ee44g48748b");
xmlHttp.onreadystatechange = function() {
    if (xmlHttp.readyState === 4) {
        console.log(xmlHttp.responseText)
    }
}
xmlHttp.send(null);

This error is ONLY occurring in Chrome and Firefox has no problems. I've been looking for 8 hours now and am getting desperate. Any advise on solving this?

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

0

So I found a solution. I ended up setting up a proxy server using PHP that uses CURL to call the API for me. This way, I would need to pass a custom header that was preventing me from bypassing CORS on Chrome. It works like a charm, but I was really hoping not to have to do this, so if anyone has any better ideas, let me know.

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!