Software⏱️ 2 min read📅 2026-05-31

How to Fix: Authorization header missing in PHP POST request

The issue is likely due to the fact that Postman adds an extra header called 'X-CustomRequest' which can interfere with your CORS configuration. Try disabling this header or using a different tool to make the request.

Quick Answer: Check your CORS configuration and ensure it's not being overridden by another header.

The problem you're experiencing is likely due to the fact that the `Authorization` header is being removed by the browser's CORS policy. This policy is designed to prevent cross-origin requests from making unauthorized requests on behalf of the user.

💡 Why You Are Getting This Error

  • [Cause]

✅ Best Solutions to Fix It

Method 1: Using the `Access-Control-Allow-Headers` Header

  1. Step 1: In your PHP script, add the following line of code to include the `Authorization` header in the response: `header('Access-Control-Allow-Headers: Authorization');

Method 2: Using the `Authorization` Header in the POST Request

  1. Step 1: In your PHP script, use the `curl` extension to set the `Authorization` header when making the POST request: `curl_setopt($ch, CURLOPT_HTTPHEADER, array('Authorization: Bearer mytoken'));

✨ Wrapping Up

By implementing one of these methods, you should be able to successfully read the `Authorization` header in your PHP script.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions