I'm creating Angular2 application using angular-cli bootstrapper and use webpack-dev-server for debugging purposes.
For some kinds of http request I want to redirect them to another backend using webpack-dev-server proxy support.
For this reason I've created proxy.conf.json file:
{
"/api/**": {
"target": "http://localhost:4201",
"secure": false
}
}
And map angular cli to use this config file:
ng serve --proxy-config proxy.conf.json
After starting console message notifies me that proxy created successfully:
NG Live Development Server is running on http://localhost:4200
Proxy created: /api/** -> http://localhost:4201
But all request from http://localhost:4200/api/users always returns with 404 status code. I tried many examples of mapping urls but nothing helps:
"/api/users" -> "http://localhost:4201/users"
"/api/" -> "http://localhost:4201/"
Data from my proxied server are requesting successfully. What I am doing wrong?