我正在使用PhoneGap和AngularJS构建应用程序。
我遇到的问题是,当我向服务器提交POST请求时,请求会永久挂起。但是,当我在不同端口上的localhost上运行服务器时,一切都按预期工作,实际上phonegap甚至没有尝试使用localhost:3000 / proxy
虽然我注意到了一些奇怪的事情,但我已经看了一段时间并且似乎无法弄清楚问题是什么。
请求不被视为XHR(在调试工具中过滤时不会显示为XHR),同样,方法标题未设置,但它显示为" POST& #34;在网络中登录Chrome开发工具。
以下是来自Chrome的成功GET请求:
Remote Address:127.0.0.1:3000
Request URL:http://localhost:3000/proxy/http%3A%2F%xxx.azurewebsites.net%2Fapi%2Flocation%2Fnearby%3Flat%3D33.8686264%26lng%3D-118.3725046
Request Method:GET
Status Code:200 OK
Request Headersview source
Accept:application/json, text/plain, */*
Accept-Encoding:gzip,deflate,sdch
Accept-Language:en-US,en;q=0.8,es;q=0.6
Connection:keep-alive
Cookie:ASP.NET_SessionId=euvpej4dpiv1ukmxl0t23xac; FedAuth=77u/PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiP....; connect.sid=s%3Aylq57xG3DkRfuNql0vtPgYWH.AgKDiQqMzswmwe1jat1CIme38V0bmecwIbdNj6O8DQ0; _gat=1; _ga=GA1.1.2047046828.1409352860
Host:localhost:3000
Referer:http://localhost:3000/
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
Response Headersview source
cache-control:no-cache
Connection:keep-alive
content-encoding:gzip
content-length:584
content-type:application/json; charset=utf-8
date:Mon, 13 Oct 2014 01:03:55 GMT
expires:-1
pragma:no-cache
server:Microsoft-IIS/8.0
set-cookie:ARRAffinity=dc683772935cbd7c69ab3a4b248dc744da819f1d1ec4860117f383527d8e64a7;Path=/;Domain=xxx.azurewebsites.net
vary:Accept-Encoding
x-aspnet-version:4.0.30319
x-powered-by:ASP.NET
这是继续永久挂起" PENDING"的帖子请求。我注意到没有Request Method,并且由于一些莫名其妙的原因,content-type附加了charset = utf-8。 有没有办法一起禁用代理,以便我可以执行标准的CORS请求?
Request URL:http://localhost:3000/proxy/http%3A%2F%2Fxxx.azurewebsites.net%2Fapi%2Fobservations%2Fcreate%3FapiKey%3Dy4hf9bmesrht3fy9fttf5c4y7maqwmq47
Request Headers
Provisional headers are shown
Accept:application/json, text/plain, */*
Content-Type:application/json;charset=UTF-8
Origin:http://localhost:3000
Referer:http://localhost:3000/
User-Agent:Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/37.0.2062.124 Safari/537.36
X-DevTools-Emulate-Network-Conditions-Client-Id:567F5745-35A5-460C-B08B-817C30F388CB
Request Payloadview source
{altitude:, date:2014-10-13, hasSpecimen:false, notes:,…}
altitude: ""
confidence: "1.0"
date: "2014-10-13"
hasSpecimen: false
latitude: 33.8686264
location: "Manhattan Beach, California, USA, , "
longitude: -118.3725046
name: ""
notes: ""
vote: ""