본문 바로가기

소프트웨어-이야기/Web

HTTP 리소스 출처 확인하기 - origin, site, Sec-Fetch-Site Header

Origin이란?

origin은 URL에서 스키마, 호스트, 포트를 합한 것을 말한다.

 

 

https://www.example.com/foo Url이 있다면, https://www.example.com:443 이 origin이다.

 

same origin 식별 샘플

 

 

 

Site

site는 TLD(Top-level domains. ex. .com / .kr )과 TLD 이전 도메인의 조합을 말한다.

예를 들어, https://www.example.com/foo URL에서 site는 example.com 이다.

 

schemeful same-site

same-site는 schema를 보지 않는다. 그러나 http가 취약 채널을 통해 사용되는 것을 막아야하는 경우, same-site보다 더 엄격한 기준인 schemeful same-site을 사용한다.

schemeful same-site에서 port, sub-domain는 중요하지 않다.

 

 

 

Request에서 same-site, same-origin, cross-site을 구분하는 방법

chrome에서는 HTTP 요청 시, same-site, same-origin, cross-site 여부를 Sec-Fetch-Site Reuqest Header에 담아 보낸다.

 

 

2020년 4월 기준 chrome 외에서는 이 기능을 지원하지 않으며, schemeful-same-site 여부는 지원하지 않는다.

 

참고

https://web.dev/same-site-same-origin/