Ionic 2 has deprecated ionic.config.js. ionic.project is now ionic.config.json, and I'm supposed to put my settings in there now. So, following the instructions for ionic proxies for ionic (can't find ionic2 doc for this anywhere), my ionic.config.json now looks like this:
{
"name": "newapp",
"app_id": "",
"v2": true,
"typescript": true,
"proxies": [{
"path": "/api",
"proxyUrl": "https://api.service.com"
}]
}
But, this doesn't appear to work.
UPDATE: I seem to be getting the proxied service, but I am still getting CORS errors.
To set up a proxy server for a VPN connectionSelect the Start button, then select Settings > Network & Internet > VPN. Select the VPN connection, then select Advanced options. Under VPN proxy settings, select the type of proxy setup you want to use, then enter the proxy server information for that VPN connection.
The issue I was having was with the server itself... it is not enough to restart it after changing the configuration. The server must be quit and a new one started with ionic serve
to behave correctly.
The above configuration, in ionic.config.json
is the correct way to configure a proxy.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With