Mackski Posted February 19, 2017 Share Posted February 19, 2017 $config->ajax is being set locally, however the exact same call for my client it is not. The request for my client is rather long, 25 seconds. However, I'm stumped as to why, this should not affect this code: $config->ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'); If I remove the if($config->ajax) from my ajax function, everything works as expected. Headers sent look correct: Accept:application/json, text/javascript, */*; q=0.01 Accept-Encoding:gzip, deflate, sdch Accept-Language:en-US,en;q=0.8 Connection:keep-alive Cookie:wire=vg8bth2bcv2c8gq58nbbfean61; wire_challenge=nVbLGO0aHzCu%2FMO9ekc4t.N6ol.xf8s5 Host:** Referer:http://*** User-Agent:Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/56.0.2924.87 Safari/537.36 X-Requested-With:XMLHttpRequest Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 19, 2017 Share Posted February 19, 2017 Do I understand this correctly, that the client does test the site on a different server than you local one? The question is not only if headers are correctly sent, but also if those headers make it to the server. Some hosters have crazy setups with nginx or even varnish in front of the actual webserver, so things could easily get lost on the way. Link to comment Share on other sites More sharing options...
Mackski Posted February 19, 2017 Author Share Posted February 19, 2017 The client is actually accessing my local server. I've tested with some other clients who don't see this issue. Strangly it's only happening in one page. My Ajax call is sent to a different URL within the project. The same call is also being used elsewhere without issue. Link to comment Share on other sites More sharing options...
Robin S Posted February 19, 2017 Share Posted February 19, 2017 21 hours ago, Mackski said: $config->ajax = (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && $_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest'); I'm probably missing something, but not sure why you are overriding $config->ajax here. This variable is set for you by PW when the current request is AJAX - you shouldn't have to set this yourself. Link to comment Share on other sites More sharing options...
Mackski Posted February 19, 2017 Author Share Posted February 19, 2017 25 minutes ago, Robin S said: I'm probably missing something, but not sure why you are overriding $config->ajax here. This variable is set for you by PW when the current request is AJAX - you shouldn't have to set this yourself. No, I was just showing the line of code which appears to not work. Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 20, 2017 Share Posted February 20, 2017 Did you try to log the contents of $_SERVER['HTTP_X_REQUESTED_WITH']? Maybe this header is stripped out anywhere on the way to your local server. Link to comment Share on other sites More sharing options...
Mackski Posted February 20, 2017 Author Share Posted February 20, 2017 Yes for this one call the headers are striped but I have no idea why or where this is happening. Link to comment Share on other sites More sharing options...
Wanze Posted February 20, 2017 Share Posted February 20, 2017 Can you find out on which browser this is happening? I remember having this problem once when a JQuery plugin was sending the ajax requests - of course only with an ancient version of Internet Explorer Link to comment Share on other sites More sharing options...
Mackski Posted February 20, 2017 Author Share Posted February 20, 2017 Latest Chrome on PC. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now