본문 바로가기

[CORS 오류] Access to XMLHttpRequest at 'http://localhost:8000/' from origin 'http://localhost:3000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present o..

by Jyujae 2022. 8. 19.

CORS가 또 문제를 일으켰다.

 

먼저 해결방안부터

 

1. 

pip install django-cors-headers

2.

installed_apps 에 추가

 

3. 

Middleware 추가

4. 

CORS_ORIGIN_WHITELIST = [
    "http://localhost:3000",
    "http://127.0.0.1:8000",
]

해결!