# "https://" for the App-Server protocol instead of "capacitor://" on iOS?

**URL:** <https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116>\
**Category:** Capacitor\
**Created:** [November 23, 2020, 11:40pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116 "2020-11-23T23:40:55Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![geckse](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/geckse/32/135051_2.png) [@geckse](https://forum.ionicframework.com/u/geckse)\
**Post date:** [November 23, 2020, 11:40pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/1 "2020-11-23T23:40:55Z")

</div>

I’m mega thrilled that iOS 14.3 [seems to add finally video capabilities to webRTC](https://twitter.com/tomayac/status/1329339360685264896) for WKWebview-Apps.  
So also to ionic and capacitor. That iOS version is only in Beta but I couldn’t really wait and tried to test it with ionic.

Which worked so far (finally!) as expected, and I only had one real problem remaining:  
It seems like it need to run on “https://”, even on localhost. By default, Capacitor serves the webapp via the custom protocol “capacitor://”. I saw, that there are [options to change the app-server](https://capacitorjs.com/docs/config), in fact I actually used that to test my assumption and added a external URL to a SSL secured webspace and webRTC worked.

Heres a simplified example: [https://github.com/geckse/ionic-capacitor-webrtc-camera-example](https://github.com/geckse/ionic-capacitor-webrtc-camera-example)

So… naturally I tried:

```auto
  "server": {
    "hostname": "localhost",
    "iosScheme": "https",
    "androidScheme": "https",
  }

```

Which did not work.

So I was wondering: Is there any way to build the App with an App-Server, which is actually “[https://localhost](https://localhost)” on iOS? (On Android it seemed so far possible)

---

<div class="post-metadata">

**Author:** ![jcesarmobile](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jcesarmobile/32/127095_2.png) [@jcesarmobile](https://forum.ionicframework.com/u/jcesarmobile)\
**Post date:** [November 24, 2020, 4:21pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/2 "2020-11-24T16:21:42Z")

</div>

no, it’s not possible, https is reserved by the WKWebView for external resources, so can’t be used for internal resources

---

<div class="post-metadata">

**Author:** ![geckse](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/geckse/32/135051_2.png) [@geckse](https://forum.ionicframework.com/u/geckse)\
**Post date:** [November 24, 2020, 5:10pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/3 "2020-11-24T17:10:32Z")

</div>

Ok I kind of expected something like this. It definitly feelt unusual to require “https://” on localhost for those APIs…

So it might be more a less a problem with webRTC / the navigator.mediaDevices API itself, 'cuz it just can’t work in apps which run WKWebView to access the local app server?

---

<div class="post-metadata">

**Author:** ![gabrielstuff](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gabrielstuff/32/135131_2.png) [@gabrielstuff](https://forum.ionicframework.com/u/gabrielstuff)\
**Post date:** [November 29, 2020, 9:53pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/4 "2020-11-29T21:53:50Z")

</div>

Any ticket where we can show our voice ?  
Now that [https://bugs.webkit.org/show\_bug.cgi?id=208667](https://bugs.webkit.org/show_bug.cgi?id=208667) is fixed, we would need [https://bugs.webkit.org/show\_bug.cgi?id=138169](https://bugs.webkit.org/show_bug.cgi?id=138169) to come to a reality.

It really looks like a never ending story.

In electron we can simply declare the protocole as secure: [https://www.electronjs.org/docs/api/protocol](https://www.electronjs.org/docs/api/protocol)

Does a Capacitor App which would simply embed a PWA hosted on https would work ?

---

<div class="post-metadata">

**Author:** ![geckse](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/geckse/32/135051_2.png) [@geckse](https://forum.ionicframework.com/u/geckse)\
**Post date:** [December 7, 2020, 10:19pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/5 "2020-12-07T22:19:24Z")

</div>

I did indeed test it that way, just to figure out that the https:// was the issue. So, yep, you could do that with capacitor and webRTC will work. Here a capacitor.config…json:

```auto
 "server": {
    "iosScheme": "https",
    "androidScheme": "https",
    "url": "https://dev.geckse.de/webrtc",
    "allowNavigation": ["*.geckse.de"]
  }

```

**BUT** I’m pretty sure it is against the appstore guidelines (Guideline 4.2, I believe). Beside the bad impact on the app-performance and increased data-traffic for users…

---

<div class="post-metadata">

**Author:** ![gabrielstuff](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/gabrielstuff/32/135131_2.png) [@gabrielstuff](https://forum.ionicframework.com/u/gabrielstuff)\
**Post date:** [December 8, 2020, 8:39am UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/6 "2020-12-08T08:39:45Z")

</div>

Well, I’m also sure you can’t deliver an empty nutshell to the app store.

What I was saying is does the capacitor team plan to support secure custom protocol ?

In order to make the WebRTC features work this is the way.

---

<div class="post-metadata">

**Author:** ![geckse](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/geckse/32/135051_2.png) [@geckse](https://forum.ionicframework.com/u/geckse)\
**Post date:** [December 14, 2020, 2:32pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/7 "2020-12-14T14:32:12Z")

</div>

This is so frustrating…

I’ve tried **navigating** the Webview for the **one page** with WebRTC to an external webhost with “https://”… so I only would have to leave the actual app for this single page.

```auto
 // Navigate window or InAppBrowser to external page with WebRTC
 window.open("https://dev.geckse.de/webrtc",'_self', 'location=yes');

```

It kind of works… but so I just run into another iOS WKWebkit issue: It just keeps asking for permissions _every_ time! (This is by the way also for every PWA the case.)  
([https://stackoverflow.com/questions/48847388/how-to-permanently-allow-usage-of-camera-on-trusted-websites-with-ios-safari](https://stackoverflow.com/questions/48847388/how-to-permanently-allow-usage-of-camera-on-trusted-websites-with-ios-safari))

It seems like running from a **local file** “file://index.html” also works, so I was like: “yeah lets try this”… but as was to be expected you can’t serve a File trough WKWebview with Capacitor without changing the URL to something like “capacitor://assets/file.html”  
([https://ionicframework.com/docs/core-concepts/webview](https://ionicframework.com/docs/core-concepts/webview))

So… maybe **iframes** to a secure location might work?

```auto
<iframe src="https://dev.geckse.de/webrtc" allow="camera https://dev.geckse.de; microphone https://dev.geckse.de;" style="height: 100vh; width: 100vw;" >
</iframe>

```

Nagh! This workaround results just in the _" NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission."_

* * *

I feel like we are here really stuck. Again. 😑

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [December 14, 2020, 2:49pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/8 "2020-12-14T14:49:43Z")

</div>

Seems this might be getting out of scope for the original topic? Consider opening a new post to discuss webRTC features.

---

<div class="post-metadata">

**Author:** ![mikeyyyzhao](https://avatars.discourse-cdn.com/v4/letter/m/0ea827/32.png) [@mikeyyyzhao](https://forum.ionicframework.com/u/mikeyyyzhao)\
**Post date:** [December 15, 2020, 10:44pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/9 "2020-12-15T22:44:08Z")

</div>

I understand that this thread is geared toward making the origin https:// but is it even possible to make the origin http://? I need this for google auth since google’s Authorized JavaScript origins does not take in capacitor:// as a valid input.

I’ve tried setting iosScheme to “http” but it’s still not working.

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [December 18, 2020, 6:35pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/10 "2020-12-18T18:35:14Z")

</div>

You can set it to http, but you’ll need to make sure you run `cap sync` to copy over the config file.

---

<div class="post-metadata">

**Author:** ![jcesarmobile](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/jcesarmobile/32/127095_2.png) [@jcesarmobile](https://forum.ionicframework.com/u/jcesarmobile)\
**Post date:** [December 23, 2020, 12:37pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/11 "2020-12-23T12:37:06Z")

</div>

No, you can’t use http nor https for loading local assets, the only way of using http or https is by loading external resources, which is against Apple TOS and can ban your app if you do it.

---

<div class="post-metadata">

**Author:** ![ciccilleju](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/ciccilleju/32/135142_2.png) [@ciccilleju](https://forum.ionicframework.com/u/ciccilleju)\
**Post date:** [January 29, 2021, 6:45pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/12 "2021-01-29T18:45:04Z")

</div>

> [@mhartington](#):
>
> You can set it to http, but you’ll need to make sure you run `cap sync` to copy over the config file.

sorry for the dumb question: how can you set it to http?  
can you write an example? thank you!

---

<div class="post-metadata">

**Author:** ![svschaik999](https://avatars.discourse-cdn.com/v4/letter/s/a5b964/32.png) [@svschaik999](https://forum.ionicframework.com/u/svschaik999)\
**Post date:** [February 12, 2021, 1:04am UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/13 "2021-02-12T01:04:25Z")

</div>

Is there any further information on this topic? Is the only way to access webrtc functionality in an iframe/wkwebview if it’s served externally as a pwa?

Is this best done with angular SSR or is there a better way of going about this?

Is it perhaps possible to use a local web server on the device that gets accessed by the iframe?

---

<div class="post-metadata">

**Author:** ![Prabhu1058](https://avatars.discourse-cdn.com/v4/letter/p/5f8ce5/32.png) [@Prabhu1058](https://forum.ionicframework.com/u/Prabhu1058)\
**Post date:** [April 28, 2021, 3:47pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/14 "2021-04-28T15:47:34Z")

</div>

> [@geckse](#):
>
> ```auto
> "server": {
> "iosScheme": "https",
> "androidScheme": "https",
> "url": "https://dev.geckse.de/webrtc",
> "allowNavigation": ["*.geckse.de"]
> }
> 
> ```

Did you find any solutions?

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [April 30, 2021, 6:48pm UTC](https://forum.ionicframework.com/t/https-for-the-app-server-protocol-instead-of-capacitor-on-ios/200116/15 "2021-04-30T18:48:52Z")

</div>


