API Gateway Proxy: headers are case sensitive
See original GitHub issueDescription
HTTP headers are case insensitive according to the HTTP spec. However, the only way to access request headers is:
request.Headers["My-header"];
which is case sensitive.
Reproduction Steps
This code below should return the same header value:
var header1 = request.Headers["My-header"];
var header2 = request.Headers["My-hEAder"];
var header3 = request.Headers["my-headEr"];
but it’s returning different values because header name is case sensitive. You can easily check this code by yourself.
Logs
No logs are necessary.
Environment
- Build Version: Amazon.Lambda.Core 2.0.0, Amazon.Lambda.APIGatewayEvents 2.4.0
- OS Info: Windows 10
- Build Environment: VSCode + Terminal
dotnet - Targeted .NET Platform: netcoreapp3.1
Resolution
- 👋 I can/would-like-to implement a fix for this problem myself
This is a 🐛 bug-report
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
AWS API Gateway Custom Authorization header case ...
Header matches are case sensitive, which as you stated is against the spec. I don't have an ETA for fixing this but it...
Read more >Amazon API Gateway important notes
Header names and query parameters are processed in a case-sensitive way. The following table lists the headers that may be dropped, remapped, or...
Read more >Transforming API requests and responses
Header names are case-insensitive. API Gateway combines multiple header values with commas, for example "header1": "value1,value2" . Some headers are reserved.
Read more >AWS API Gateway gotchas
Header names are processed as case sensitive. In AWS' list of known issues, they say: API Gateway enacts the following restrictions and ...
Read more >Headers are getting convert into lower case? | Layer7 API ...
Hello Folks, I am facing issue when client is sending Headers in CAPITAL letters, those headers are being converted into lower by API...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

@Mikilll94 Thanks for your response. I just came across Amazon API Gateway important notes. For the bullet point
API Gateway enacts the following restrictions and limitations when handling methods with either Lambda integration or HTTP integration, it mentionsHeader names and query parameters are processed in a case-sensitive way.. Looks like this is a limitation from the service side where user could send 2 headers with same name, but different in case. Given this limitation, I’m not sure how this could be implemented in Lambda HLL. Hope this helps.⚠️COMMENT VISIBILITY WARNING⚠️
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.