cordova-ios 6.x.x - How to add support for multiple hostnames?

Viewed 1583

With the release of cordova-ios 6.0.0, WKWebview is the default web view now. It works well for API calls with a single host. However, it doesn't seem to support multiple hosts at the same time. I needed to configure it such that it supports my company domain xxx.com as well as localhost.

The following preferences works well if applied separately for the respective domains. But not both at the same time. The issue I'm noticing in this case is, the API calls are not attaching the SESSION cookie in the request header.

<preference name="hostname" value="localhost" />
<preference name="hostname" value="xxx.com" />

I've following property enabled as well.

$httpProvider.defaults.withCredentials = true;
1 Answers

I used this same code on config.xml:

<preference name="scheme" value="app" />
<preference name="hostname" value="localhost" />

Another thing, but I need to enable CORS on server side to works well, but if you can't change anything in the server (my case) you can enable this plugin from oracle and I can do any call:

cordova plugin add cordova-plugin-wkwebview-file-xhr

Say me if this help you?

Related