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

136
Visualizações
create react app proxy is not working using a different domain api

My app is running on localhost: 3000

I am trying to call an API from a different domain "https://redcap-internal.indocresearch.org/api/" inside my app.

I added a proxy in the package.json file of my react app like:

"proxy": "https://redcap-internal.indocresearch.org/api/",

I am using axios to call the API and my code is like the below:

function createRedCapRecordAPI(containerGUID) {
    return axios({
        url: "https://redcap-internal.indocresearch.org/api/",
        method: "POST",
        data: {
            token: REDCAP_TOKEN,
            content: "record",
            format: "json",
            type: "flat",
            overwriteBehavior: "normal",
            forceAutoNumber: false,
            data: [{ record_id: containerGUID }],
        },
    });
};

I am still getting an error from the broswer says

Access to XMLHttpRequest at 'https://redcap-internal.indocresearch.org/api/' from origin 'http://localhost:3000' has been blocked by CORS policy:

Anyone knows is there anything wrong?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Allowing cors headers, like Access-Control-Allow-Origin and Access-Control-Allow-Headers should be added on this https://redcap-internal.indocresearch.org/api/ domain side. You cannot fix it only on your side

about 4 years ago · Juan Pablo Isaza Relatório
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