我在使用ionic中的代理配置时遇到问题,找不到404。
相信设置是正确的,因为日志会打印出以下内容。
[22:40:14] Proxy added:/api/* => http://localhost:8082/
[22:40:14] Proxy added:api/* => http://localhost:8082/
[22:40:14] Proxy added:/api => http://localhost:8082/
[22:40:14] Proxy added:api => http://localhost:8082/
....
[22:40:24] dev server running: http://localhost:8100/
这就是我所谓的api
findPhotosByGeo(page: number,lat:number,lng:number): Observable<any> {
let url = `/api/photo/geo?lat=${lat}&lon=${lng}&radius=10&per_page=${this.perPage}&page=${page}`;
return this.findPhotosGeneral(url);
}
在浏览器中尝试了以下内容。
以下给出404:
http://localhost:8100/api/photo/geo?lat=40.5964698&lon=-73.9782571&radius=10&per_page=5&page=0
以下给出正确的响应:
http://localhost:8082/api/photo/geo?lat=40.5964698&lon=-73.9782571&radius=10&per_page=5&page=0
这就是为什么我认为代理服务器没有为我重定向。
离子信息
Your system information:
ordova CLI: 7.0.1
Ionic Framework Version: 3.3.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.10.2
Xcode version: Not installed