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

229
Visualizações
Fixing CORS error issue axois.get MissingAllowOriginHeader

Okay so: I'm running a LightSail instance at www.gethatext.com.

  • FrontEnd - React, BackEnd - Django

On the homepage, I'm making 2 get requests to the Django server.

It is important to say that both Django & React are being served in the apache server.

  • .conf file of apache (http & https)

    ProxyPass /api http://localhost:8000. # Django.
    ProxyPassReverse /api http://localhost:8000 # Django.
    ProxyPass / http://localhost:3000/. # React.
    ProxyPassReverse / http://localhost:3000/. #React.

So I investigated and read that i need to add the following to the .conf file in either <Directory>, <Location> or <VirtualHost>. and so I did (and restarted all services of source).

<IfModule mod_headers.c>
   Header set Access-Control-Allow-Origin "*"
</IfModule>

BUT it did not help.

Devtools Network

But when I'm making the same request from POSTMAN in my computer I get a the expected response (After running from the instance terminal python manage.py runserver 0.0.0.0:8000)

POSTMAN

I Also added https://cors-anywhere.herokuapp.com to my request
So it looked like:

axois.get("https://cors-anywhere.herokuapp.com/https://gethatext.com/api/account/quantity/")....

and surprisingly IT WORKED..
But it doesn't feel like a good practice and also in terms of data privacy.

So I wonder what is it the problem here?

Is it related to that, that Django and React are both served in the same apache service?

Also add to axois header:

  • "Access-Control-Allow-Origin": "*"

But with no luck

Browser console error:
Browser Error

Cheers guys & Thanks in advnace.

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

So the solution for this one was
Adding:

  • "proxy" : "https:my-domain.com".
    to the package.json and in the axios requests.

    axios.get("/upload/quantity/").then()...
    And it worked

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