PhoneGap Ajax请求返回502(坏网关),而AT&T数据,但不是在WiFi上

PhoneGap Ajax Request returns 502 (bad gateway) while on AT&T data but not on WiFi

本文关键字:数据 WiFi AT 返回 请求 Ajax 网关 PhoneGap      更新时间:2023-09-26

使用PhoneGap制作iOS应用程序,我正在做一些非常简单的事情(向远程API发出ajax请求)。在我的物理设备(iPhone 4)上测试时,当我使用WiFi发出请求时一切正常,但当我通过at&t数据计划发出请求时,我得到502坏网关响应(如下)。我觉得它是在PhoneGap连接类,但我可能可能是错的…我知道我的服务器正在正确地接收请求,因为它在我的数据库中创建了一个实例,这只是响应在AT&T数据上被阻塞了。

这是我的AJAX打印输出和错误参数

$.ajax(
{
  url : 'http://remotehost.com/api/users/login',
  type : 'POST',
  dataType : 'json',
  data : $('#user_login').serializeArray(),
  success : function(result)
  {
  }
});
2011-10-10 00:05:12.983 Emoome[481:707] [INFO] Object:
readyState = 4
setRequestHeader = function (a, b) {t===0&&(l[a.toLowerCase()]=b);return this;}
getAllResponseHeaders = function () {return t===2?m:null;}
getResponseHeader = function (a) {var b;if(t===2){if(!n){n={};while(b=bs.exec(m))n[b[1].toLowerCase()]=b[2]}b=n[a.toLowerCase()]}return b||null;}
abort = function (a) {a=a||"abort",o&&o.abort(a),w(0,a);return this;}
promise = function (a, c) {if(a==null){if(e)return e;e=a={}}c=z.length;while(c--)a[z[c]]=b[z[c]];return a;}
isRejected = function () {return c||b;}
isResolved = function () {return c||b;}
fail = function () {if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this;}
done = function () {if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this;}
then = function (a, c) {b.done(a).fail(c);return this;}
success = function () {if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this;}
error = function () {if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this;}
complete = function () {if(!e){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=d.type(i),j==="array"?f.done.apply(f,i):j==="function"&&a.push(i);k&&f.resolveWith(k[0],k[1])}return this;}
statusCode = function (a) {if(a){var b;if(t<2)for(b in a)k[b]=[k[b],a[b]];else b=a[v.status],v.then(b,b)}return this;}
responseText = <html><body><h1>502 Bad Gateway</h1>
    The server returned an invalid or incomplete response.
    </body></html>
status = 502
statusText = error

我终于弄明白了这个该死的问题。与at&t或PhoneGap无关……我们仍然不确定前者是否没有责任,因为at&t是阴暗的…这个问题实际上是在我的CodeIgniter REST服务器-我的应用程序正在为每个登录请求(ajax POST请求)创建一个新的会话条目,不知何故,当回到at&t的电线我的应用程序决定这是一个502错误,因为它没有看到cookie或会话数据。

对于仍然有这个问题的人,我也有这个问题。当我从应用程序向服务器发送请求时,我有一个setcookie函数。

这就是我所做的:setcookie('like'.$_POST[qid])。, '1', time() + (60 * 60), '/');

当我移除set cookie时,一切都很好。非常奇怪。