Proxy 离子2代理不再工作了

Proxy 离子2代理不再工作了,proxy,ionic2,Proxy,Ionic2,我有一个Ionic 2应用程序,当我使用Ionic serve时,该应用程序带有一个代理I用户进行开发。在我的配置文件中,这一切都很好: "proxies": [ { "path": "/apiv2/", "proxyUrl": "https://myapilink.com/apiv2/" } ] 在我的Ionic provider中: constructor(public http: Http) { this.API_URL = "/api

我有一个Ionic 2应用程序,当我使用
Ionic serve
时,该应用程序带有一个代理I用户进行开发。在我的配置文件中,这一切都很好:

"proxies": [
    {
      "path": "/apiv2/",
      "proxyUrl": "https://myapilink.com/apiv2/"
    }
]
在我的Ionic provider中:

  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);
              });
      });
  }
当我使用
爱奥尼亚服务
运行我的爱奥尼亚项目时,我可以看到添加了代理:
[09:54:50]已添加代理:/apiv2/=>https://myapilink.com/apiv2/

但当我运行我的应用程序时,当API调用到来时,在我的网络日志中,我只有500个错误:

POST http://localhost:8100/apiv2/ 500 (Internal Server Error)
但在爱奥尼亚服务器运行时,如果我在chrome上输入以下URL:
http://localhost:8100/apiv2/
,我得到了API的结果和JSON返回,因此进行了重定向。我不明白它是从哪里来的


提前感谢您的帮助

github中有一些指南:。 也许在ionic.config.json中,您应该这样配置:

"proxies": [
    {
      "path": "/apiv2/",
      "proxyUrl": "https://localhost:8100/apiv2/"
    }
]

github中有一些指南:。 也许在ionic.config.json中,您应该这样配置:

"proxies": [
    {
      "path": "/apiv2/",
      "proxyUrl": "https://localhost:8100/apiv2/"
    }
]