클라이언트측에서 서버로 simple requests(아래 링크 참고)에 해당하는 요청이 아닌 요청을 보내면
https://developer.mozilla.org/ko/docs/Web/HTTP/Access_control_CORS
HTTP 접근 제어 (CORS)
cross-origin request의 예: https://domain-a.com에서 제공되는 프론트 엔드 JavaScript 코드가 XMLHttpRequest를 사용하여 https://domain-b.com/data.json를 요청.
developer.mozilla.org
CORS preflight 가 발생하게 된다.
CORS preflight는 OPTION이라는 HTTP메소드로 서버측에 먼저 헤더의 내용들이 허가되는지를 요청한다.
서버측에서 허락해주는 헤더들이라면, 원래 하고자 하던 요청을 클라이언트가 서버에게 할 수 있게된다.
content-type에 관한 상세정보는 아래링크
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types
MIME types (IANA media types)
A media type (also known as a Multipurpose Internet Mail Extensions or MIME type) is a standard that indicates the nature and format of a document, file, or assortment of bytes.
developer.mozilla.org
'웹' 카테고리의 다른 글
react-redux practice (0) | 2020.01.28 |
---|---|
React-practice (0) | 2020.01.28 |
HTTP (0) | 2020.01.15 |