Serve locally using Https


Is there a way to configure ionic to serve locally using https?
My remote host is SSL and all secure cookies are lost when they come back to the non-SSL browser.

What is the easiest way to solve my problem?

Thanks in advance.


Can you give an example of what you are trying to do. Why would you be serving https from ionic?


after I logged in to SSL server it sends back secure cookie with sessionId.
I need that cookie to make other requests BUT non-SSL browser mode doesn’t allow to share secure cookies.
As a result I can not sent sessionId and have 401 ‘Unauthorized’ response from a server.


after I logged in to SSL server it sends back secure cookie with sessionId.

So is your ionic app connecting to a server using SSL or is it Serving SSL?

  1. I’m sending authentication request from my app to SSL server using ionic proxy.
  2. Server response contain sessionId in secure cookie.
  3. I’m sending another request that suppose to have this sessionId in requestHeader cookie.

In reality the last request doesn’t have sessionId in requestHeader coockie and thats why I get 401 ‘Unauthorized’.
When I look at responseHeader cookie of the first request I see the following:
set-cookie:PHPSESSID=5583u6dcq803qlm5mnnc79vua4i0hs10htoj1mavskhv0bdg8m31; path=/; secure; HttpOnly

My idea is to make it somehow run locally in secure mode so that this secure cookie would be passed through.


Hey @qvatra !, Im currently facing the same issue. It would be nice to have something like “ionic serve https” to bootstrap localhost in a secure environment, what is required by a lot of services like google maps, aws cognito, auth0, firebase, etc. Not sure where the confusion is @rwildcard , it is a very common use case. If ionic were using something like browsersync, we could just add our self-signed certs in a config file i.e.:

,“https”: {
“key”: “/Users/rcfrias/.localhost-ssl/key.pem”,
“cert”: “/Users/rcfrias/.localhost-ssl/cert.pem”

@rwildcard what do you mean with -> “Why would you be serving https from ionic” afaik ionic uses the “serve” command to create a standalone web server to host the ionic app, not to serve anything else. So by “serve” it can only be the app itself. Default -> http://localhost:8100/ / desired -> https://localhost:8100/


I have the same problem, how can we use https://localhost:8100 ?
In my case I can’t use cordova-plugin-geolocation with --livereload because it’s forbidden to get geolocation from unsecured origins:


@fdambrosio Did you ever find a solution to this problem? I’m attempting to configure my application to serve through https to fix this exact same problem as well. Pretty disappointed by how complicated most “solutions” I’ve come across have been.


@zachonahill no I’m sorry, I’ve not found a solution yet


Hey, I am also facing the same issue. Did you able to resolve this issue.