1
由於angular-cli很好地成熟,我決定移植一個Angular2應用程序來利用angular-cli的精彩。然而,代理到在本地主機上運行的外部遠程服務正在瘋狂旅行。Angular2網頁包代理配置
版本信息
ng --version
angular-cli: 1.0.0-beta.19-3
node: 7.0.0
os: darwin x64
因此,從角度的應用程序,我想代理所有/service/**
請求發送到Nginx的運行一個RESTful API @http://localhost.api.co.za
配置
{
"/service/*" : {
"target":"http://localhost.api.co.za/",
"secure": false,
"changeOrigin": true,
"pathRewrite": {
"^/service": ""
}
}
}
的nginx access.log輸出一個 POST /api/v1/testing HTTP/1.1" 404 169 "http://localhost:4200/contact"
嘗試了所有的招數在這個端口webpack-dev-server proxy dosen't work
的https: //webpack.github.io/docs/webpack-dev-server.html#proxy – Manish