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

183
Vistas
Django Rest Framework Cors issues with query params

When I make a GET request without queryparams my backend provides the data no problem, but if I pass any queryparams the request gets rejected.

[Example of Rejection in network tab, status column says CORS ERROR][1]

The fetch being made is this (it's within a react useEffect)

fetch('http://localhost:8000/gems/' + new URLSearchParams({
      filters: 'all'
}))

If I remove the + params it works just fine, but removing the trailing slash also causes the issue.

in package.json I have added this

  "proxy": "https://localhost:8000/",

The backend view is this (going to overwrite get_queryset to read the params)

class GemViewSet(viewsets.ModelViewSet):
    queryset = Gem.objects.all()
    serializer_class = GemSerializer

and I've installed the cors app, added the middleware and set

CORS_ALLOW_ALL_ORIGINS = True

If someone could set me on the right track I'd be very grateful. [1]: https://i.stack.imgur.com/g0dIp.png

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