cordova-plugin-ionic-webview
cordova-plugin-ionic-webview copied to clipboard
feat(ios): add http(s) proxy/scheme
This adds a new URLSchemeHandler which can proxy http(s) requests to external servers. This is useful for some CORS issues and webview bugs that affect the use of cookies in CORS requests via XHR and fetch.
See Webkit bug https://bugs.webkit.org/show_bug.cgi?id=200857
For that reason cookies will be synced between proxied requests on the native layer and the webview.
If this feature is usefull and gets merged, the documentation needs to be updated probably here: https://beta.ionicframework.com/docs/building/webview#file-protocol ?
I'm running tests over iOS 13.1.2 and the cookies doesn't reach the server in fetch requests, i.e. <img src="https://mydomain.com/img.jpg" />, but I don't know if there are some kind of configuration or function must need to call before the html is rendered.
You must use the convertFileSrc Javascript function to convert your URLs for using the proxy
This was done with some suggestions from @jcesarmobile . Do you have any comments on the implementation?
This is the corresponding documentation that needs to be updated in case this gets merged: https://github.com/ionic-team/ionic-docs/blob/master/src/pages/building/webview.md
Seems like #376 is the Android version of this change. Adding this feature may mean integrating both PRs.
I just rebased and resolved conflicts with https://github.com/ionic-team/cordova-plugin-ionic-webview/commit/cbd526d
Documentation needs to be updated. For basic instrutions see this: https://github.com/ionic-team/cordova-plugin-ionic-webview/issues/475#issuecomment-553871614
@jcesarmobile Do you see any chances this could be merged? I don't know how relevant this is for the upstream plugin, but I try to mimize forked plugins in our app.
I now know this breaks Anroid currently.
I tried running this, and it seems to reliably crash my iOS app. Not sure how to provide more info.
@alexsasharegan You could open you iOS platform in Xcode and run it from there on an iPhone. If the app crashes, you should see an error in the Xcode consoe.
@NiklasMerz can you please resolve the conflict and thanks ^_^