确保使用的版本是最新的Angular CLI版本。
在proxy-config.json文件中,确保你使用的是通配符,而不是正则表达式。例如:
{
"/api/*": {
"target": "http://localhost:3000",
"secure": false,
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
}
}
{
"/api": {
"target": "http://localhost:3000",
"secure": false,
"pathRewrite": {
"^/api": ""
},
"changeOrigin": true
}
}