I'm finding that in IE 9 and other browsers, PHP's env('HTTP_X_REQUESTED_WITH') gives "XMLHttpRequest" when an Ajax request is made, but that in IE 8 it doesn't.
IE 8 sends "x-requested-with: XMLHttpRequest" instead of the more usual "X-Requested-With: XMLHttpRequest". Is this difference in field name case the reason? http://www.ietf.org/rfc/rfc2616.txt says that HTTP header field names are case-insensitive.
The Hiawatha changelog has "Case-insensitive HTTP-header matching" down against version 3.5.
I found https://www.hiawatha-webserver.org/forum/topic/136 , which mentions version 6.10.
I don't know C, but perhaps 'headerfield_to_environment(session, fcgi_buffer, "X-Requested-With:", "HTTP_X_REQUESTED_WITH");' makes the field name case sensitive?
14 December 2012, 00:07
Hiawatha does have case insensitive header matching. Are you saying that with IE8 the HTTP_X_REQUESTED_WITH environment variable is not set? I just tested it and it worked just fine.
14 December 2012, 00:27
Yes, it seems it's not set for me in IE8. With IE8, the following PHP does not return 'XMLHttpRequest':
I tested the above from within a CakePHP app view by echoing it. In IE8, The value ("XMLHttpRequest") is not output when the codebase is running on Hiawatha, but it is when running on Apache, and, likewise, the associated Ajax functionality doesn't/does work.
It's used in CakePHP 1.3 here: https://github.com/cakephp/cakephp/blob/1.3/cake/libs/controller/components/request_handler.php#L300
14 December 2012, 07:32
Upgrade to the latest version (or at least 8.5) and your problem will be solved.