WKWebView - CORS issue

34 views
Skip to first unread message

Christer Nordvik

unread,
May 8, 2024, 7:13:10 AMMay 8
to ima...@googlegroups.com
Hi, 

When we embed a webpage with IMA JS SDK that serves ads, we are unable to serve ads in our iOS app. For various reasons we can't use the native iOS SDK so is there any way to make it work inside the app? We can serve the ad with no problems when opening the same page in Safari. 

What we see is that we are running into CORS issues. The VAST spec indicates that this should work fine as long as the request is "originless". But I don't see a way we can make this work without manually proxying all the ad calls and changing the headers. 

image.png

- Christer

Christer Nordvik

unread,
May 8, 2024, 7:13:15 AMMay 8
to Interactive Media Ads SDK
Hi,

When we embed a webpage with IMA JS SDK that serves ads, we are unable to serve ads in our iOS app. For various reasons we can't use the native iOS SDK so is there any way to make it work inside the app? We can serve the ad with no problems when opening the same page in Safari.

What we see is that we are running into CORS issues. The VAST spec indicates that this should work fine as long as the request is "originless". But I don't see a way we can make this work without manually proxying all the ad calls and changing the headers.

VAST spec: 
image.png 

IMA SDK

unread,
May 8, 2024, 1:13:24 PMMay 8
to chri...@norapps.no, ima...@googlegroups.com

Hi Christer,

Thank you for contacting the IMA SDK Support team.

Since the app can serve the ad with no problems when opening the same page in Safari I can confirm that the integration of IMA SDK is correct. 

Modern browsers apply same-origin security restrictions to JavaScript network requests, meaning that a web application running from one origin cannot retrieve data served from a different origin.  The restriction poses problems for VAST served in a JavaScript environment because an ad server is often on a different domain than the ads player. However, Cross-Origin Resource Sharing (CORS) headers is a W3C recommendation that works around this restriction by allowing sharing across different origins.

To avoid cross-origin problems, VAST ad server responses to requests made by the SDK must include the following HTTP CORS headers:
Access-Control-Allow-Origin: <origin header value>
Access-Control-Allow-Credentials: true

For further instructions on enabling CORS, see Enable cross-origin resource sharing.

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02tIume:ref" (ADR-00234132)

Thanks,
 
Google Logo IMA SDK Team


Reply all
Reply to author
Forward
0 new messages