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

241
Visualizações
response status code 200 but cors error in react js axios

I am trying to hit a open source API from https://citizenatlas.dc.gov/newwebservices/locationverifier.asmx/findLocation2 using axios. My code is:

let fetchDCWardUrl = 'https://citizenatlas.dc.gov/newwebservices/locationverifier.asmx/findLocation2?str=2%252015th%2520St%2520NW,%2520Washington,%2520DC%252020024,%2520USA&f=json';

await axios.get(fetchDCWardUrl).then((response) => {
      console.log(response);
    });

And I am getting: enter image description here enter image description here When I hit the same URL from the postman or directly hit the browser URL bar, I get a response without any error. I also tried using the post method, tried js fetch.

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

0

Cors must be enabled on server-side. For development purposes you can use react proxy settins but on production server you must correctly setup your server to create proxy for this request

about 4 years ago · Juan Pablo Isaza Relatório

0

I think the website must allow the request from javascript. Thats a server side thing. You shouldn't be able to send request to the backend without proof that you are the "real" frontend it belongs to. Its a security feature from your browser. If you open this normaly the browser doesn't catch that...

To fix that you could write your own backend which catches the request and sends the content to your frontend and then set the cors there.

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