amazon-web-servicesamazon-ec2http-headersamazon-elb

AWS Application Load Balancer transforms all headers to lower case


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.

  1. Is it expected behavior of Application Load Balancer?
  2. Is there a way to configure it to return headers as they have been built by the application?

Solution

  • It is expected when using HTTP/2, which requires clients to lowercase all headers. Because ALBs support HTTP/2 this means that clients which connect using HTTP/2 will convert all headers to lowercase before sending the request as required by RFC 7540. If your application allows HTTP 1.x requests, those clients may send headers using any case and a standards-compliant server is required to handle them case-insensitively.