[▲ Vercel Community](/) · [Categories](/categories) · [Latest](/latest) · [Top](/top) · [Live](/live)

[Help](/c/help/9)

# Django rest framework vercel

53 views · 1 like · 4 posts


Nqabandiweni (@nqabandiweni) · 2024-08-01

i have deployed a django rest framework rest api on vercel, the issue is when i query from my frontend it returns html but when i type the endpoind directly in address bar it returns json as expected.


Pauline P. Narvas (@pawlean) · 2024-08-01

Hi and welcome to the community, @nqabandiweni!

It sounds like issue likely stems from your frontend not sending the correct `Accept` header. 

When you access the endpoint directly, the browser sets this header to `application/json`, but your frontend might not. Take a look at your frontend requests and make sure to include the `Accept: application/json` header. 

It's also worth checking your Django REST Framework settings to default to JSON responses.


Nqabandiweni (@nqabandiweni) · 2024-08-02 · ♥ 1

Thanks  for the help, turns out the issue was with vercel authentication that is on by default


Pauline P. Narvas (@pawlean) · 2024-08-02

Thanks for coming back with your solution!