I am currently experiencing an issue with my Laravel API on a cPanel-hosted environment. When making API requests from Postman with a Bearer token in the Authorization header, the token is not being received by the application. This setup works as expected on my local environment, where the Bearer token is successfully passed and retrieved by the application. However, in the cPanel environment, the Authorization header appears to be missing or stripped out.
I have already tried the following troubleshooting steps:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
<IfModule mod_headers.c>
Header always set Access-Control-Allow-Origin "*"
Header always set Access-Control-Allow-Headers "Authorization, Content-Type, X-Requested-With"
</IfModule>
I am getting a null value when trying to retrieve the Bearer token using $request->bearerToken() in middleware.
I am using cPanel for my hosting environment.