ioscordovaionic-frameworkionic-webview

cordova-plugin-ionic-webview sending null origin in iOS


I've got an ionic 3 hybrid/cordova app that uses the cordova-plugin-ionic-webview plugin (which will use WKWebView in iOS). I've historically always used an old version of this plugin due to compatibility issues (@1.2.1). Suddenly today, new builds started having issues where my app was sending origin: null for the origin headers on http requests. I've read of others having this issue too, but it's clear by the docs that this plugin has had iterations of doing other flavors of origins (but not null).

I decided to upgrade and see what happened. I upgraded to the latest 2.x version (@2.3.1). I got the same result. I then removed this plugin (which I believe uses a non-WkWebView webview), and everything works again, but I want to use this plugin for the performance benefits.

Up until today I believe the origin was always http://localhost:8080 on iOS. Has anyone else seen the origin get set to null with this plugin? Any ideas why or how to fix it?


Solution

  • I tracked this down to an incompatibility with the 1.11.16 version of the cordova-plugin-code-push plugin. Seems that this plugin is stepping on the origin when the cordova-plugin-ionic-webview plugin is used. This is a fairly recent change - not sure which version made this start happening. The 1.11.14 and 1.11.16 releases both note messing with the ionic wkwebview plugin support.

    I opened an issue here: https://github.com/Microsoft/cordova-plugin-code-push/issues/489