How to configure proxies using ionic2?

Ionic 2 has deprecated ionic.config.js. ionic.project is now ionic.config.json, and I must now set my settings there. So, following the instructions for ionic proxies for ionic (I can’t find an ionic document 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 that does not work.

UPDATE: I seem to get a proxy service, but I still get CORS errors.

+5
source share
1 answer

The problem I encountered was related to the server itself ... this is not enough to restart it after a configuration change. The server should be shut down, and the new one should start with ionic serve in order to behave correctly.

The above configuration in ionic.config.json is the correct way to configure proxies.

+6
source

Source: https://habr.com/ru/post/1247078/


All Articles