Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure a proxy using ionic2?

Tags:

proxy

ionic2

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.

like image 367
Wayne Werner Avatar asked Apr 13 '16 22:04

Wayne Werner


People also ask

How do you configure the proxy server settings?

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.


1 Answers

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.

like image 73
Wayne Werner Avatar answered Nov 28 '22 17:11

Wayne Werner