Ok, it really seems that ionic currently has no support for this. This is how you have to modify Ionic to make things work:
-
find the Ionic serve.js file, i.e. on a mac: /usr/share/nodejs/node-v0.12.0/lib/node_modules/ionic/lib/serve.js
-
search for this code:
var opts = url.parse(proxy.proxyUrl); if(proxy.proxyNoAgent) opts.agent = false;
-
Add this line after the if statement:
var opts = url.parse(proxy.proxyUrl); if(proxy.proxyNoAgent) opts.agent = false; opts.rejectUnauthorized = !(proxy.rejectUnauthorized === false);
-
Add rejectUnauthorized = false to your proxy configuration:
{ "name": "proxy-example", "app_id": "", "proxies": [ { "path": "/api", "proxyUrl": "https://localhost:8181/api", "rejectUnauthorized" : false } ] }
This works just fine, because Ionic uses internally proxy-middleware which supports any of the https request options, for more information see here.
rejectUnauthorized is a setting from proxy-middleware
That works like a charm. I hope the Ionic guys will merge the one line of code into their distribution so that everyone can use this