Skip to content

fix: make Authorization header check case-insensitive #1528

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Louis454545
Copy link

Summary

Fixes #1043

This PR makes the Authorization header detection case-insensitive, which is the correct behavior according to HTTP RFC standards. Previously, the code only checked for the exact string 'Authorization' in headers, but HTTP headers should be case-insensitive.

Changes Made

  • Replace case-sensitive 'Authorization' in this.headers check with case-insensitive Object.keys(this.headers).some(key => key.toLowerCase() === 'authorization')
  • This allows headers like 'authorization', 'Authorization', 'AUTHORIZATION' to all work correctly

Testing

  • All existing unit tests pass
  • Build completes successfully
  • Manual testing with various header case combinations (lowercase, uppercase, mixed case)
  • Verified that no authorization header case still works correctly

Root Cause

The issue was introduced in the hasCustomAuthorizationHeader check which was meant to detect custom auth headers but was using case-sensitive string matching instead of proper case-insensitive header handling.

Additional Notes

This is a small but important fix that improves compatibility with various HTTP client implementations that may use different casing for the Authorization header.

🤖 Generated with Claude Code

Co-Authored-By: Claude [email protected]

- Fix issue supabase#1043 where custom Authorization headers were checked case-sensitively
- HTTP headers should be case-insensitive according to RFC standards
- Replace exact key match with case-insensitive check using Object.keys().some()
- This allows headers like 'authorization', 'Authorization', 'AUTHORIZATION' to work correctly
@mandarini mandarini self-assigned this Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New check for a custom Authorization header is case sensitive. Headers are case insensitive
2 participants