1
当我使用ionic serve
时,我有一个Ionic 2应用程序和一个用于开发的代理用户。所有与这在我的配置文件伟大的工作:离子2代理不再工作
"proxies": [
{
"path": "/apiv2/",
"proxyUrl": "https://myapilink.com/apiv2/"
}
]
在我离子提供商:
constructor(public http: Http) {
this.API_URL = "/apiv2";
this.data = {};
}
call(action, entity, params){
return new Promise(resolve => {
let link = this.API_URL;
let data = JSON.stringify({action: action, entity: entity, params: params});
this.http.post(link, data)
.map(res => res.json())
.subscribe(data => {
this.data = data;
resolve(this.data);
}, error => {
console.log(error);
});
});
}
当我跑我的离子项目,ionic serve
,我可以看到代理添加:
[09:54:50] Proxy added:/apiv2/ => https://myapilink.com/apiv2/
但是当我运行我的应用程序,当API调用来了,在我的网络日志中我只有500错误:
POST http://localhost:8100/apiv2/ 500 (Internal Server Error)
虽然Ionic服务器正在运行,但是如果我使用chrome并输入此网址:http://localhost:8100/apiv2/
,我的API的结果是,我的JSON返回,因此重定向已完成。我不明白的地方它是从
感谢来提前为任何帮助