Ionic serve over SSL/HTTPS


Has anyone successfully implemented a project that can run over HTTPS when using the ionic serve command (https://localhost:8100) . I am developing an app locally that uses Stripe Payments and the Stripe API requires that the app be on SSL

Many thanks

1 Like

Hey, i haven’t tried it myself but you could take a look at this issue and see if you can brew something up

So not sure why you need ionic serve to run on HTTPS. I assume you need the app to connect to your backend on HTTPS? IF so then yes, I am using that mode for my app and it works fine in desktop mode too (via ionic serve). In my case, ionic serve is over http, but the app is using HTTPs to connect to the backend data service.

If you are using a self signed cert, to make it work in desktop mode, make sure you launch the browser and point it to your website that has that cert - you will get an ‘accept certificate’ prompt - go ahead and accept it. Then do ionic serve and it will work

I can already connect to my backend which is on HTTPS, by using proxy in the ionic.project file, which is fine for all platforms.

The problem I am having is linking to a javascript script which is on HTTPs (Stripe Payments - I can’t develop locally unless I run ionic serve on HTTPs


Ah thank you. That was good learning for me.

May I ask why you need to use proxy for backend SSL and where can I read up about that? I also connect to a backend SSL service and don’t use a proxy. I’d like to understand the trade-offs better.

I’m sorry I couldn’t address your question - hopefully someone can chime in.

I use it so that I can connect to my backend API without running into any CORS issues. It works well for me as I use ionic serve in the browser as well as testing on the emulator and the device itself. There is documentation on the ionic guides section which explains Service Proxies and how to implement them here:

1 Like

Any update on this. I am developing an app with Stripe payment too and I am facing the same issue.

Yeah, also on stripe any updates?

I am still getting an error in my console when including https stripe on localhost. However the application still works and I can process payments. I am also running my application in production now across ios and android devices and have had no problems with processing payments. So I think you may be okay to just run with it, while the error still shows :expressionless:

This is a pretty important issue, particularly when working with PhoneGap. PhoneGap will connect to remote services without CORS issues but local environment will not.

For insecure requests the ionic proxy is great but when the remote host is SSL any secure cookies are lost when they come back to the non-SSL browser.

This means for the many 3rd party services things like Login will fail when accessing through ionic service proxy.

++ for the ability to add any SSL cert to the proxy service. That will allow secure cookies to flowback to the client.

Off to configure MAMP (again). Sigh.