[wpe-webkit] Allowing CORS for custom URI scheme

Ryan Walklin ryan at testtoast.com
Sun May 5 15:53:49 PDT 2019


I'm trying to get communication between my app and a WebKitWPE instance going, using the advice in this thread - https://lists.webkit.org/pipermail/webkit-wpe/2018-June/000019.html.

What I want to do is register a custom URI scheme, which I've done with webkit_web_context_register_uri_scheme(). Then I want to load my UI into WPE, using either webpack for development, or a bundle file URL for deployment. Then my plan was to use my custom URI to make API calls into my app to update the UI with XHR, ie with an app hosted from (via webpack-dev-server) call 

$.ajax({ customuri://function/with/some/state }) 

and get JSON back to update the UI. However I get CORS errors, even after setting webkit_security_manager_register_uri_scheme_as_cors_enabled() for my custom scheme. The URI scheme callback fires, however I think because the response from the callback doesn't include the Access-Control-Allow-Origin '*' header, webkit then drops the response. 

Is there any way to solve this and let me use a custom URI this way, or is there a better way to have this API style interaction with the WPE host app?



More information about the webkit-wpe mailing list