Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

453
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda