Puya Sarmidani Puya Sarmidani - 1 year ago 118
Ajax Question

Custom headers not showing with $_SERVER

Im trying to set a custom header like the code below:

beforeSend: function (request)
request.setRequestHeader("X_PJAX", 'true');
url: url,
dataType: 'json',
success: function(msg) {

The response is a 200 OK so i assume that it went ok.
But when i try getting the headers with
it shows all the headers except the custom one i just set.

Has this something to do with Apache or with my code?

I've checked mod_headers and it is enabled.
Also tried to set the custom header with PHP and still no result and no errors.

Answer Source

You should use apache_request_headers read more about this here APACHE REQUEST HEADERS $_SERVER contains Predefined values for the system and server , apache_request_headers will get your custom added headers.:

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download