Cross-Origin Resource Sharing (CORS) headers is a W3C draft specification meant to allow sharing across different origins. To be servable in a JavaScript environment a VAST ad server's response must include the following HTTP CORS headers:
This HTTP header allows an ads player on any origin to read the VAST response from the ad server origin. The value ofAccess-Control-Allow-Origin: <origin header value>
Access-Control-Allow-Credentials: trueAccess-Control-Allow-Origin:should be the value of theOriginheader sent with the ad request. TheAccess-Control-Allow-Credentials:header will ensure that cookies will be sent and received properly.
$ curl --head --header "origin: https://imasdk.googleapis.com" --request GET 'https://bs.serving-sys.com/Serving?cn=display&c=23&pl=VAST&pli=20896934&PluID=0&pos=2874&ord=123123123&cim=1'
HTTP/1.1 200Cache-Control: no-cache, no-storePragma: no-cacheContent-Type: text/xml; charset=UTF-8Expires: Sun, 05-Jun-2005 22:00:00 GMTServer: Microsoft-IIS/7.5Set-Cookie: S_2874=7510697228925946678; expires=Mon, 08-May-2017 06:38:00 GMTSet-Cookie: CISI_2874=ei=43588556_asi=0_di=0_il=0_sid=7510697228925946678; expires=Sat, 06-May-2017 14:53:00 GMTSet-Cookie: u2=9cbf64ca-30ce-4ab5-95c5-0ecd86ffed274ec070; expires=Fri, 04-Aug-2017 14:38:00 GMT; domain=.serving-sys.com; path=/Access-Control-Allow-Origin: *X-Powered-By: ASP.NETP3P: CP="NOI DEVa OUR BUS UNI"Date: Sat, 06 May 2017 18:38:56 GMTContent-Length: 1831
$ curl --head --header "origin: https://imasdk.googleapis.com" --request GET 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=1234567'
HTTP/1.1 200 OKP3P: policyref="https://googleads.g.doubleclick.net/pagead/gcn_p3p_.xml", CP="CURa ADMa DEVa TAIo PSAo PSDo OUR IND UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"Timing-Allow-Origin: *Google-MediationGroup-Id: -2Access-Control-Allow-Origin: https://imasdk.googleapis.comAccess-Control-Allow-Credentials: trueGoogle-LineItem-Id: 697200496,697200496Google-Creative-Id: 57860459056,57857370976Date: Sat, 06 May 2017 18:46:46 GMTPragma: no-cacheExpires: Fri, 01 Jan 1990 00:00:00 GMTCache-Control: no-cache, must-revalidateContent-Type: text/xml; charset=UTF-8X-Content-Type-Options: nosniffServer: cafeX-XSS-Protection: 1; mode=blockSet-Cookie: test_cookie=CheckForPermission; expires=Sat, 06-May-2017 19:01:46 GMT; path=/; domain=.doubleclick.netAlt-Svc: quic=":443"; ma=2592000; v="37,36,35"Accept-Ranges: noneVary: Accept-EncodingTransfer-Encoding: chunked
$ curl --head --header "origin: foobar" --request GET 'https://pubads.g.doubleclick.net/gampad/ads?sz=640x480&iu=/124319096/external/single_ad_samples&ciu_szs=300x250&impl=s&gdfp_req=1&env=vp&output=vast&unviewed_position_start=1&cust_params=deployment%3Ddevsite%26sample_ct%3Dskippablelinear&correlator=7654321'
HTTP/1.1 200 OKP3P: policyref="https://googleads.g.doubleclick.net/pagead/gcn_p3p_.xml", CP="CURa ADMa DEVa TAIo PSAo PSDo OUR IND UNI PUR INT DEM STA PRE COM NAV OTC NOI DSP COR"Timing-Allow-Origin: *Google-MediationGroup-Id: -2Access-Control-Allow-Origin: foobarAccess-Control-Allow-Credentials: trueGoogle-LineItem-Id: 697200496,697200496Google-Creative-Id: 57860459056,57857370976Date: Sat, 06 May 2017 18:50:45 GMTPragma: no-cacheExpires: Fri, 01 Jan 1990 00:00:00 GMTCache-Control: no-cache, must-revalidateContent-Type: text/xml; charset=UTF-8X-Content-Type-Options: nosniffServer: cafeX-XSS-Protection: 1; mode=blockSet-Cookie: test_cookie=CheckForPermission; expires=Sat, 06-May-2017 19:05:45 GMT; path=/; domain=.doubleclick.netAlt-Svc: quic=":443"; ma=2592000; v="37,36,35"Accept-Ranges: noneVary: Accept-EncodingTransfer-Encoding: chunked