Search code examples
androidionic-frameworkhttpswebviewcapacitor

Loading webview with https with ionic and capacitor


I'm trying to build an apk which have to load with https://mydomain with ionic 4 and capacitor. In capacitor.config.json I precise this field :

"server" : {
  "hostname": "mydomain"    
}

Cause I do some API call in that domain. The problem is, I want my app to load with https://mydomain when running the app, in debug or apk mode.

I even tried to do that in capacitor.config.json

"server" : {
  "hostname": "https://mydomain"    
}

But it just did this call

 http://https://mydomain

when I run the app. So it just keep adding "http://" to the hostname.

Do you have any idea on what can I do to have my app running with https instead of http ?

I'm using ionic 4 and capacitor, and I'm testing all this in Android Platform using Android studio for the moment (but I will have the same for IOS).

Thanks


Solution

  • Use the follwoing in capacitor.config.json:

    {
      "hostname": "mydomain.com",
      "androidScheme": "https"
    }