동일-출처 정책

위키백과, 우리 모두의 백과사전.

동일-출처 정책(영어: same-origin policy)는 웹 애플리케이션의 중요한 보안 모델이다.

동일-출처 정책은 주로 스크립트로부터의 데이터 접근에 적용된다. 즉, 일치하는 HTML 태그를 경유하는 이미지, CSS, 스크립트 등 출처를 경유하여 리소스를 임베드하는 것은 제한되지 않는다.[1] (글꼴은 잘 알려진 예외임[2])

출처 결정 규칙[편집]

비교 대상 URL 결과 이유
http://www.example.com/dir/page2.html 성공 프로토콜, 호스트, 포트가 동일
http://www.example.com/dir2/other.html 성공 프로토콜, 호스트, 포트가 동일
http://username:password@www.example.com/dir2/other.html 성공 프로토콜, 호스트, 포트가 동일
http://www.example.com:81/dir/other.html 실패 프로토콜, 호스트가 동일하지만 포트가 다름
https://www.example.com/dir/other.html[깨진 링크(과거 내용 찾기)] 실패 프로토콜이 다름
http://en.example.com/dir/other.html 실패 호스트가 다름
http://example.com/dir/other.html 실패 호스트가 다름 (정확한 일치 필요)
http://v2.www.example.com/dir/other.html 실패 호스트가 다름 (정확한 일치 필요)
http://www.example.com:80/dir/other.html 상황에 따라 포트 명시적. 브라우저의 구현에 따라 결과가 다를 수 있음.

같이 보기[편집]

각주[편집]

  1. Kemp, John (2011년 2월 4일). “Security on the Web”. 2018년 7월 24일에 확인함. The same-origin policy states that a document from one unique origin may only load resources from the origin from which the document was loaded. In particular this applies to XMLHttpRequest calls made from within a document. Images, CSS and dynamically-loaded scripts are not subject to same-origin policy. 
  2. “@font-face”. 《MDN Web Docs》 (미국 영어). 2018년 7월 24일에 확인함. Web fonts are subject to the same domain restriction (font files must be on the same domain as the page using them), unless HTTP access controls are used to relax this restriction. 

외부 링크[편집]