CORS 교차 오리진 리소스 공유

CORS mean Cross-Origin Resource Sharing

An origin is a scheme (protocol), host (domain) and port

ex) https://www.example.com (implied port is 443 for HTTPS, 80 for HTTP)

-Web Browser based mechanism to allow requests to other origins while visiting the main origin

-Same origin : http://example.com/app1 & http://example.com/app2

-Different origins : http://www.example.com & http://other.example.com

-the requets won't be fulfilled unless the other origin allows for the requests, using CORS Headers(ex:Access-Control-Allow-Origin)

CORS는 교차 오리진 리소스 공유이다.

즉, 리소스를 다른 오리진에서 얻을 수가 있는 것이다.

오리진이란 체계(프로토콜), 호스트(도메인), 포트이다.

예시 : https://www.example.com은 체계가 hhtps이고, 호스트가 www.example.com, 포트가 443이다.

웹 브라우저에는 기본적인 보안으로 CORS를 갖추고 있는데 이는 웹사이트를 방문했을 때 오리진이 허락 할 때에만 요청을 보낼 수 있도록

허락하는 설정이다. 브라우저 기반 보안인 것.

같은 오리진은 첫 번째와 두 번째 URL끼리 웹 브라우저 요청이 가능하다.

example.com에서 other.example.com에 대한 요청을 할 경우 이를 교차 오리진 요청이라고 하며 이때 올바른 CORS 헤더가 없으면

웹 브라우저가 해당 요청을 차단한다.


S3 CORS

-If a client does a cross-origin request on our S3 bucket, we need to enable the correct CORS headers

-You can allow for a specific origin or for *(all origins)

클라이언트가 웹사이트로 활성화된 S3 버킷에 대해 교차 오리진을 요청하는 경우 올바른 CORS 헤더를 활성화 해야 한다.

특정 오리진에 대해 허용할 수 있거나 혹은 *(아스테리스크)로 전체 오리진을 허용할 수도 있다.

+ Recent posts