Django redirect is blocked by CORS

My django redirects are blocked by CORS, even though I did everything to set up CORS: I installed django-cors-headers in the virtual environment, I added corsheaders to the INSTALLED_APPS and I added corsheaders.middleware.CorsMiddleware to the top of MIDDLEWARE, I also added this to the bottom of my settings.py file:

CORS_ALLOW_ALL_ORIGINS = True

CORS_ALLOW_HEADERS = [
    'content-type',
    'authorization',
    'x-csrftoken',
]

CORS_ALLOW_METHODS = [
    'GET',
    'POST',
    'PUT',
    'PATCH',
    'DELETE',
    'OPTIONS',
]

CORS_ALLOW_CREDENTIALS = True

As well as refreshing my page, restarting the server and VSCode, clearing my cache, and using an incognito window, nothing works.

The redirect is redirect("https://google.com/")

The result is always the same, it says that localhost:8000 was blocked by CORS, and that the preflight request doesn't pass the access control check, because it doesn't have an ACAO header.

Вернуться на верх