Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?
like image 947
vtor Avatar asked Oct 05 '16 10:10

vtor


People also ask

What is difference between application load balancer and load Loadr and classic load balancer?

Application Load Balancers are used to route HTTP/HTTPS (or Layer 7) traffic. Network Load Balancers and Classic Load Balancers are used to route TCP (or Layer 4) traffic.

What is difference between application and classic load balancer in AWS?

But in general, the Classic Load Balancer is likely to be the best choice if your routing and load-balancing needs can all be handled based on IP addresses and TCP ports. In contrast, the Application Load Balancer can address more complex load-balancing needs by managing traffic at the application level.

What one thing can you not do using an AWS Elastic load balancer?

You cannot add or remove availability zones for a Gateway Load Balancer after you create it.

How does AWS application load balancer work?

A load balancer serves as the single point of contact for clients. The load balancer distributes incoming application traffic across multiple targets, such as EC2 instances, in multiple Availability Zones. This increases the availability of your application. You add one or more listeners to your load balancer.


2 Answers

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.

like image 187
jzonthemtn Avatar answered Sep 28 '22 08:09

jzonthemtn


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.

Disable HTTP/2 in the load balancer attributes

like image 39
マルちゃん だよ Avatar answered Sep 28 '22 09:09

マルちゃん だよ