I just set up Apache 2.4 32-bit on my Windows 7 desktop and I am testing a simple AJAX website. I have an .htaccess file that directs all non-resource-file requests to index.php, and within this .php script I check $_SERVER["HTTP_X_REQUESTED_WITH"]
to determine if a given request is ajax or not (I set this header myself when I send the ajax request).
Though the header is getting set, Apache seems to be dropping it before my .php script runs. I can see the request header in Chrome, but it's not there in the .php script. I even tried logging \"%{X_REQUESTED_WITH}i\"
in Apache's access.log, but I don't see it there either.
This functionality works when the site is running on Bluehost. Do I need to configure Apache to get it to work on my local machine?
Apache 2.4 now drops all headers with underscores, for 'security' reasons.
According to their docs, you can add them by adding this to your htaccess:
Where Accept.Encoding and Accept-Encoding is the header name. Underscores are replaced with dots and hyphens respectively.