I have two nearly identical PHP proxy scripts that I call through nearly identical JS. The first works fine in all scenarios.
The second (code below) works on my localhost IIS server in both Firefox and Chrome. On the remote Glassfish Apache server, it works in Firefox, but returns status = 0
with empty return in Chrome (tested in v22 & v26). The two PHP proxy scripts are virtually identical and download similar length data (between 1 and 4 MB). With the following JS, the else and onerror alerts are both triggered.
var dateQueryText = interviewDays[exitDay];
xmlhttp=new XMLHttpRequest();
xmlhttp.onreadystatechange = function(){
if (xmlhttp.readyState == 4){
if (xmlhttp.status == 200){
var xmlDoc=xmlhttp.responseXML;
processGPX(xmlDoc);
}
else{alert("Download of GPS data failed for date " + dateQueryText + " Status: " + xmlhttp.status);}
}
}
xmlhttp.onerror = function (e){alert("Error encountered and download of GPS data failed for date " + dateQueryText + " Status: " + xmlhttp.status);};
xmlhttp.open("POST","proxy2.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
params = ("case=" + caseID + "&gps=true" + "&date=" + dateQueryText);
xmlhttp.send(params);
I've tried the following to no avail:
-
async
&synchronous
downloads - overriding the
return
type, since GPX (GPS data in XML format) isn't always understood by servers{xmlhttp.overrideMimeType("text/xml");}
. - providing the full path to the PHP script
What could be causing the problem in Chrome?
EDIT: Here is the request header for the failing PHP request. There is no response received.
Request URL: https://www.XXX.edu/AAA/BBB/CCC/proxy2.php
Request Headers
Cache-Control:no-cache
Content-type:application/x-www-form-urlencoded
Origin:https://www.XXX.edu
Pragma:no-cache
Referer:https://www.XXX.edu/AAA/BBB/CCC/exitgraphic.php?case=TESTCASE&instrument=0001&mode=TEST
User-Agent:Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.4 (KHTML, like Gecko) Ubuntu/12.10 Chromium/22.0.1229.94 Chrome/22.0.1229.94 Safari/537.4
Form Data
case:TESTCASE
inst:0001
mode:TEST
gps:true
date:02222013