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

184
Visualizações
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 à 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