My angular-cli version is 1.4.4, I follow the construction here to set backend proxy: How to set backend proxy with angular-cli
So I generate a file called proxy.conf.json next to package.json, the content is:
{
"/api": {
"target": "http://localhost:8080",
"secure": false
}
}
However, When I type command ng serve --proxy-config proxy.conf.json
, I didn't see any tip to say proxy has been set, the output is :
As you can see, it only has info of webpack compiling, no info about
[HPM] Proxy created: /api -> http://localhost:8080
has been outputed.
And now I have an api call, the api route is /api/authenticate
. I suppose it should redirect to http://localhost:8080/api/authenticate
, however it didn't, still point to http://localhost:4200/api/authenticate
, of course it return 404 not found. Can anyone tell me why ?