WKWebview CORS doubt

Recently I’ve implemented WKWebview on my ionic 3 app.

On the Ionic blog the WKWebview article says

UIWebview, or the older webview in iOS, never actually enforced CORS, but WKWebView does and does not provide a way to disable it. To address this, you need to implement CORS correctly and add the following entry:

Origin: http://localhost:8080

IF this is not possible (you do not own the API), a workaround can be to use the native HTTP plugin, @ionic-native/http.

It enforces cors even if --consolelogs and --livereload doesn’t activated?

Before if --c and --l are activated I used the ionic proxy but if the --consolelogs and --livereload not activated the request worked correctly without proxy.

Can someone clarify me this please?

Yes, CORS is always enforced with WKWebView.

Any tutorial about how migrate from httpclient angular to http ionic native?

I believe this covered in some forum posts.

Is there nowadays any “Frontend” method to still using Angular httpclient and solves the CORS problem?

Whitelist on backend is not an option and it would be nice to not use the native http client.

Thanks

Found any solution? Even I’m stuck with the same, I have a service which uses Angular HTTP client and Observable to return data. Its very difficult to change everything to ionic native HTTP :frowning:

In the end I ended up migrating to the new client :confused:

1 Like