error
-
flutter CORS policyerror 2023. 8. 18. 00:17
CORS policy 에러에 대한 flutter 쪽 해결 방안이다. 에뮬에서 실행할 시에는 걱정 할 필요가 없지만 웹으로 에뮬을 돌릴 시에 add의 경우에는 서버에 쪽에서 받기만 하기에 서버쪽 설정만 해줘도 되지만 response를 받는 경우를 생각하지 못했다. response를 받는 경우에는 flutter쪽에서 동일 로컬호스트에 포트만 다른경우로 들어오는 것이기에 CORS 정책에 걸리는 것이다. 이는 unawaited(xhr.onError.first.then((_) { // Unfortunately, the underlying XMLHttpRequest API doesn't expose any // specific information about the error itself. completer.com..
-
django CORS policyerror 2023. 8. 15. 16:15
Access to XMLHttpRequest at 'http://127.0.0.1:8000/posting/' from origin 'http://localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 같은 로컬 서버를 이용하고 포트만 다른 경우에 브라우저에서 차단을 한단다. CORS policy라고 한다. django 쪽에서 corsheaders라는 미들웨어를 쓰면 되는데 에러를 찾는 와중에 response와 request의 header에 'access-control-allow-origin'라는 헤더를 추가로 붙여주면 브라우저에서 애는..