question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API Gateway Proxy: headers are case sensitive

See original GitHub issue

Description

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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
ashishdhingracommented, Sep 24, 2021

@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 mentions Header 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.

0reactions
github-actions[bot]commented, Sep 24, 2021

⚠️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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found