[Answered ]-Cors error happening on a simplejwt authenticated webpage

1👍

According django-cors-headers documentation:

CorsMiddleware should be placed as high as possible, especially before
any middleware that can generate responses such as Django’s
CommonMiddleware or Whitenoise’s WhiteNoiseMiddleware. If it is not
before, it will not be able to add the CORS headers to these
responses.

So just add it at the top of your list, like this:

MIDDLEWARE = [
    'corsheaders.middleware.CorsMiddleware',
    ...,
]

Leave a comment