I'm facing a very odd situation, I have an Apache server setted up in 3 different machines, one is Ubuntu, other is a Mac and other is a windows 8, I'm trying to send in a very basic post request a custom header like X_USER
, to a Php script ( the same script is in the 3 machines), now in order to get my header I use the $_SERVER
var like $_SERVER['HTTP_X_USER']
, however in the Mac I get the values just fine, but in the other 2 machines, the value doesn't exist, I did var_dump in the $_SERVER
var and I can confirm the headers aren't there, I haven't configure anything fancy, just the defaults.
Can anyone tell me if I need to configure something, or I'm accessing the var in the incorrect way, or why I'm not getting the header, maybe is something at Apache level or php level, thanks for any help!!
Well I think I found the reason, I was sending the headers as X_REST_USERNAME for example, however on apache version 2.4_x the headers needs to use dashes as separators instead underscores like this X-REST-USERNAME, I have apache 2.2 on the mac and the others have version 2.4, however in both version the dash separator works ok, I didn't know all this, thanks all!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With