VAST サーバーの CORS を構成する
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
最新のブラウザでは、JavaScript ネットワークに同一オリジンのセキュリティ制限が適用されます
つまり、ある送信元から実行されているウェブ アプリケーションは、
配信する場合です。VAST の場合、このセキュリティ制限により
読み取りの JavaScript VAST レンダリング コードから作成された JavaScript XMLHttpRequests
別の配信元から配信された VAST 広告レスポンス。
このセキュリティ制限は、1 つのオリジンでこの制限を
ユーザーがログインしなくても、別のオリジンからデータを読み取る
付与します。この制限により、JavaScript で配信される VAST で問題が生じます。
というのは、広告サーバーは多くの場合、
できます。
クロスオリジン リソース シェアリング(CORS)ヘッダーは W3C のドラフト仕様で、
オリジン間の共有を可能にしますJavaScript で配信できるようにする
環境に VAST 広告サーバーのレスポンスに以下の HTTP CORS ヘッダーを含める必要があります。
Access-Control-Allow-Origin: <origin header value>
Access-Control-Allow-Credentials: true
この HTTP ヘッダーを使用すると、任意のオリジンの広告プレーヤーが VAST レスポンスを読み取ることができます。
指定することもできます
Access-Control-Allow-Origin:
の値
広告リクエストとともに送信される
Origin
ヘッダーの値である必要があります。
Access-Control-Allow-Credentials:
ヘッダーにより、
適切に送受信されることを確認します。
詳しくは、クロスオリジン リソース シェアリングに関する W3C ドラフト仕様をご覧ください。
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は 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 ad serving.\u003c/p\u003e\n"],["\u003cp\u003eThis restriction prevents JavaScript in VAST ads from loading resources like the ad response if they are hosted on a different domain than the player.\u003c/p\u003e\n"],["\u003cp\u003eCross-Origin Resource Sharing (CORS) headers enable cross-origin data access, requiring VAST ad servers to include specific headers to allow JavaScript ad players to read responses.\u003c/p\u003e\n"],["\u003cp\u003eThese CORS headers, \u003ccode\u003eAccess-Control-Allow-Origin\u003c/code\u003e and \u003ccode\u003eAccess-Control-Allow-Credentials\u003c/code\u003e, specify permitted origins and ensure proper cookie handling for seamless ad delivery.\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\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 into 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.\n\n\nCross-Origin Resource Sharing (CORS) headers is a W3C draft specification meant\nto allow sharing across different origins. To be servable in a JavaScript\nenvironment a VAST ad server's response must include the following HTTP CORS headers: \n\n```text\nAccess-Control-Allow-Origin: \u003corigin header value\u003e\nAccess-Control-Allow-Credentials: true\n```\nThis HTTP header allows an ads player on any origin to read the VAST response from the ad server origin. The value of `Access-Control-Allow-Origin:` should be the value of the `Origin` header sent with the ad request. The `Access-Control-Allow-Credentials:` header ensures that cookies are sent and received properly.\n\n\u003cbr /\u003e\n\n\nFor more information, refer to the [W3C Draft Specification on Cross-Origin Resource Sharing](//www.w3.org/TR/cors)"]]