Access to fetch at ‘https://localhost:8000/api’ from origin ‘http://localhost:3000’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource. If an opaque response serves your needs, set the request’s mode to ‘no-cors’ to fetch the resource with CORS disabled.
터미널
pip install django-cors-headers
settings.py
INSTALLED_APPS = [ 'corsheaders' ] MIDDLEWARE = [ 'corsheaders.middleware.CorsMiddleware' ] # CORS 허용 여부 True 를 하게되면 누구든 접근이 허용된다. CORS_ORIGIN_ALLOW_ALL = False # 접근 가능한 url 을 따로 관리 CORS_ORIGIN_WHITELIST = ( 'http://localhost:3000', )
package.json
"proxy": "http://localhost:8000"