How to programmatically change proxy URL for CORS?

The current way to get around CORS issues is via a config in ionic.config.json.

"proxies": [
    {
      "path": "/api",
      "proxyUrl": "http://xxx"
    }
  ]

Is there a way to switch proxyUrl at runtime?
I need to do feature that allows the user to connect to a local server, and switch back and forth between my main REST service and the local version.

I guess I could get the feature to work without needing to define a proxy, but I want to be able to test it on ionic serve if possible.

1 Like

I also want to know this question.