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

452
Views
How to resolve access control check: Redirect is not allowed for a preflight request?

I have a API endpoint i.e. http://api.example.com/contact and it is working when I tried to use the POST method but when I configured the SSL certificate with this then the URL is changed https://api.example.com/contact but method POST is not working. I have tried with the bellow code

    let response = await fetch(ApiUrlConstant.getApiFullUrl("web.contact"), {
      method: "POST",
      headers: {
        "Access-Control-Allow-Origin" : "https://api.example.com/",
        "Content-Type": "application/json;charset=utf-8",
        "Access-Control-Allow-Credentials": "true",
        "method": "POST",
      },
      body: JSON.stringify(details),
    });
    setStatus("Submit");
    let result = await response.json();
    alert(result.status);
  };

Whenever I tried method POST then I got this error

www.example.com/:1 Access to fetch at 'https://api.example.com/contact' from origin 'https://www.example.com' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: Redirect is not allowed for a preflight request.

I have gone through the article and discussion on StackOverflow but in my case, It's not working. Now it's hard to understand which one is correct or where I did wrong?

over 4 years ago · Santiago Trujillo
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!