Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

231
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda