VAST 서버용 CORS 구성
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
최신 브라우저는 JavaScript 네트워크 요청에 동일 출처 보안 제한을 적용합니다. 즉, 한 출처에서 실행되는 웹 애플리케이션은 다른 출처에서 제공되는 데이터를 검색할 수 없습니다. VAST의 경우 이 보안 제한으로 인해 JavaScript VAST 렌더링 코드에서 만든 JavaScript XMLHttpRequest가 다른 출처에서 게재된 VAST 광고 응답을 읽을 수 없습니다.
이 보안 제한은 한 출처가 사용자가 로그인되어 있을 수 있는 다른 출처의 데이터를 사용자의 권한 없이 읽을 수 있는 문제를 방지하기 위한 것입니다. 광고 서버가 광고 플레이어와 다른 도메인에 있는 경우가 많으므로 이 제한은 JavaScript 환경에서 게재되는 VAST에 문제를 일으킵니다. 그러나 교차 출처 리소스 공유(CORS) 헤더는 서로 다른 출처 간에 공유를 허용하여 이 제한을 우회하는 W3C 권장사항입니다.
CORS 헤더
교차 출처 문제를 방지하려면 SDK의 요청에 대한 VAST 광고 서버 응답은
다음 HTTP CORS 헤더를 포함합니다.
Access-Control-Allow-Origin: <origin header value>
Access-Control-Allow-Credentials: true
이러한 헤더를 사용하면 모든 출처의 광고 플레이어가 광고 서버 출처에서 VAST 응답을 읽을 수 있습니다. Access-Control-Allow-Origin
값을 설정합니다.
광고 요청과 함께 전송된 Origin
헤더의 값에 매핑되며,
Access-Control-Allow-Credentials
에서 true
로
제대로 작동하는지 확인하는 것이 중요합니다.
CORS 사용 설정에 대한 자세한 내용은 다음을 참조하세요.
교차 출처 리소스 공유를 사용 설정합니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-31(UTC)
[null,null,["최종 업데이트: 2025-08-31(UTC)"],[[["\u003cp\u003eModern browsers restrict JavaScript from accessing data from different origins for security reasons, impacting VAST ads served from a separate domain than the player.\u003c/p\u003e\n"],["\u003cp\u003eCross-Origin Resource Sharing (CORS) headers enable cross-origin data sharing, allowing VAST ads to be served from a different domain than the player.\u003c/p\u003e\n"],["\u003cp\u003eVAST ad server responses should include specific CORS headers: \u003ccode\u003eAccess-Control-Allow-Origin\u003c/code\u003e (set to the request's \u003ccode\u003eOrigin\u003c/code\u003e header value) and \u003ccode\u003eAccess-Control-Allow-Credentials\u003c/code\u003e (set to \u003ccode\u003etrue\u003c/code\u003e).\u003c/p\u003e\n"]]],[],null,["# Configure CORS for VAST servers\n\nModern browsers apply same-origin security restrictions to JavaScript network\nrequests, meaning that a web application running from one origin cannot retrieve data\nserved from a different origin. For VAST, this security restriction prevents\nJavaScript XMLHttpRequests made from JavaScript VAST rendering code from reading\na VAST ad response served from a different origin.\n\nThis security restriction is meant to prevent issues where one origin is able\nto read data from another origin that a user may be logged in to without that\nuser's permission. The restriction poses problems for VAST served in a JavaScript\nenvironment because an ad server is often on a different domain than the\nads player. However, [Cross-Origin Resource Sharing (CORS)](//www.w3.org/TR/cors)\nheaders is a W3C recommendation that works around this restriction by allowing\nsharing across different origins.\n\nCORS headers\n------------\n\nTo avoid cross-origin problems, VAST ad server responses to requests made by the SDK must\ninclude following HTTP CORS headers: \n\n```text\nAccess-Control-Allow-Origin: \u003corigin header value\u003e\nAccess-Control-Allow-Credentials: true\n```\n\nThese headers allow an ads player on any origin to read the VAST response\nfrom the ad server origin. Set the value of `Access-Control-Allow-Origin`\nto the value of the `Origin` header sent with the ad request, and\n`Access-Control-Allow-Credentials` to `true` to ensure\nthat cookies are sent and received properly.\n\nFor further instructions on enabling CORS, see\n[Enable cross-origin resource sharing](//enable-cors.org/)."]]