AWS Application Load Balancer会将所有标头转换为小写 [英] AWS Application Load Balancer transforms all headers to lower case
问题描述
我有一个在两个EC2实例中运行的REST API应用程序,并且长期使用AWS Classic Load Balancer。 REST API的客户端依赖于响应标头(例如 Location
)。
I've a REST API application running in two EC2 instance and was using AWS Classic Load Balancer for a long time. The clients of REST API rely on the response headers (e.g. such as Location
).
我知道HTTP标头在定义上不区分大小写,但是(不幸的是)一些客户端忽略了此标题,并以区分大小写的方式检查标头(例如,他们期望位置
以大写开头)。
I know that HTTP headers are case-insensitive by definition, however (unfortunately) some clients are ignoring this and checking the headers in a case-sensitive way (e.g. they expect Location
to start with upper case).
最近我已更改为AWS Application Load Balancer,现在我看到了
Recently I've changed to AWS Application Load Balancer and now I see that it transforms all response headers to lower case, as a result clients are failing to handle the response properly.
我在这里有几个问题。
- 应用程序负载平衡器的预期行为吗?
- 是否可以将其配置为按原样返回标头是由应用程序构建的?
推荐答案
这是ALB的预期功能,因为 HTTP / 2小写所有标头和ALB 支持HTTP / 2 。不幸的是,您无法修改ALB处理标头的方式。
It is an expected function of the ALB because HTTP/2 lowercases all headers and ALBs support HTTP/2. Unfortunately you can't modify how the headers are manipulated by the ALB.
更新:请参阅以下注释。我对ALB由于其对HTTP / 2的支持而将小写的请求标头小写的说法可能并不正确。
Update: See the comments below. My statement that the ALB lowercases the request headers due to its support for HTTP/2 may not be accurate.
这篇关于AWS Application Load Balancer会将所有标头转换为小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!