问题
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
).
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).
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.
I've couple of questions here.
- Is it expected behavior of Application Load Balancer?
- Is there a way to configure it to return headers as they have been built by the application?
回答1:
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.
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.
回答2:
This was causing our broken clients to fail when we switched from TCP ELB to HTTPS ELB.
While we fix our clients, we temporarily disabled the new ELB HTTP/2 support, which comes enabled by default.
来源:https://stackoverflow.com/questions/39871250/aws-application-load-balancer-transforms-all-headers-to-lower-case