Why are the Authorisation headers removed from my request when making an api call? How to fix with WHM

These are the steps to enable authorization headers for a linux server using Apache:

First thing to try is:

Go to WHM, open the Terminal then type:

sudo nano /etc/apache2/conf.d/includes/pre_main_global.conf

Inside the file, add this line: 

SetEnvIf Authorization “(.*)” HTTP_AUTHORIZATION=$1

Save and close the file then search HTTP Server (Apache) and restart it

Try sending your request again. If the server still strips the headers then try this:

This will occur when CGI and SuExec are in use and are the assigned PHP handlers. Removing SuExec and using RUID2 will allow the headers to be set. You can also use an alternative handler such as SuPHP, PHP-FPM, or LSAPI. 

To make the change, navigate to the EasyApache interface to install or remove the handler, and then set the PHP handler through the MultiPHP Manager. 

f you choose to remove SuExec and utilize RUID2, this will require the following changes:

From EasyApache2 enable

mod_mpm_prefork

mod_cgi

mod_ruid2

RUID2 is also not compatible with LSAPI, SuPHP, or PHP-FPM, as indicated by these warnings in the EA4 interface:

The mod_fcgid Apache module is not compatible with the mod_ruid2 or mod_mpm_itk Apache modules.

The mod_lsapi Apache module is not compatible with the mod_ruid2 or mod_mpm_itk Apache modules.

suPHP is not compatible with the mpm_itk or the mod_ruid2 Apache module. You must uninstall suPHP if you want to use these modules.

If removing SuExec for RUID2 is not possible for your environment, and you cannot switch the PHP handler to LSAPI, SUPHP, or PHP-FPM, as an alternative, you can set the headers at the global level. Please review How to use Apache includes to add configuration directives to a specific domain’s virtualhost

Menu