Run webView with https

For those who are stuck on that since the documentation is not yet updated. In the capacitor.config.json
in the server section:
“server”: {
“hostname”: “localhost:3000”,
“iosScheme”: “https”,
“androidScheme”: “https”
},

on iOS you can’t use https, that should default to capacitor://

Is that right for Cordova also

In cordova it defaults to ionic://

This is kind of a big problem. Many 3rd parties require https origins these days. Any work arounds?

2 Likes

Are you sure about that? This thread seems specifically to be about Ionic internals, so:

I’m not seeing how 3rd parties would be involved at all in how the Ionic app gets at stuff that’s baked into its bundle.

Can you describe the problem you’re actually encountering? If it doesn’t have to do with stuff that’s bundled with the app, maybe a new thread would be a better choice than this one.

Perhaps my issue is a lack of understanding, or documentation. Please help clarify for me.

So if the app itself is running the webview without https/ssl -does it still communicate with outside APIs securely?

Last question, the third-party example was a reference to Stripe payments. Their frontend JS library embeds some payment UI controls, and insists that the site it’s embedded in is using https. This seems like if would be effected by the http webview, is that not right?

Yes, as long as you’re passing https: URLs to libraries that fire off XHRs (such as Angular HttpClient).

I’ve used Stripe, and I’ve written Ionic apps, but haven’t yet done the two together. This cordova plugin claims to be able to interact with Stripe in Ionic apps (and there’s an Ionic Native shim). I would think that if you had to jump through any additional hoops to get that to work, it would be documented there.

Is there a way to run webview with http? Google auth right now does not support anything other than http and https for Authorized redirect URIs

I’m having a similar issue:
I’m using an Iframe which gives me back the following error:
Refused to display ‘https://www.liveincam.com/’ in a frame because it set ‘X-Frame-Options’ to ‘SAMEORIGIN’.

they say it’s because the protocol is capacitor:// and they are expecting a request over https.

there is anything i can do for fixing it?

while it works perfectly on android (it gives me https as protocol) i’m stuck with iOS

thanks!

I am struggling to find a way to implement apple pay because of the same issue.
It needs to come from https.
https://stripe.com/docs/stripe-js/elements/payment-request-button#html-js-prerequisites

Did anyone find a way around this?
Seems like it can potentially be an issue with many third party API’s.

Im having same problem with Accept.js payment integration. In Android works fine using shceme https. In ios is not posible to use https, is httpsionic instead, but Accepts.js does not recognize that as htpps and return error

I want to change protocol from capacitor:// to “http://” or “https://”. as i want to use Service worker in Capacitor iOS app & it only works with HTTP or HTTPS.
Please suggest me any way to do that

I’m also looking for a way to replace the iosScheme to include https… it would be great if we could do this

In case it’s still not clear, this is NOT possible, it’s an Apple limitation, they don’t allow to use an scheme that the WKWebView already handles, such as http, https, file, and a few others (undocumented)

1 Like

It is not possible in iOS.
Got reply in one of my github issue

i’m using apple pay and google pay with the capacitor stripe plugin, it works perfectly.

Thanks for the response. I have also found that this works.

The limitation the capacitor / native version seems to have vs the web version of Apple pay is that it requires a merchant id which is not a great solution in my case as I have hundreds of connected Stripe accounts and would need a merchant id for each one.

I will try to see if I can find a way around this.

What do you mean hundreds of stripe accounts? Anyway if you need to change the merchant you could assign the value to a variable and, depending on which account you need, assign the value to that variable.

What type of app are you working on?

Its a SaaS platform for organizations and each one has a Stripe Connect account connected the the platform (my app/SaaS) Stripe account. Not an online marketplace but similar.
Imagine Amazon having to register a merchant id for each supplier on the platform.

Yes I could do that with a variable but its more about the manual process of having to set up a merchant id for each customer. I believe I would have to release a new version of the app with each new merchant id.

The web version of Stripe Apple pay works without the merchant id.

There may be some way to solve the issue. I have not invested a lot of time into it yet. I will be looking at it in a couple of months.

1 Like