AWS Application Load Balancer : Do more with HTTP header modification capabilities

Ravi Intodia
3 min readNov 24, 2024

--

As of few days back all the traffic which was routed through AWS Application Load Balancer (ALB) had to dependent on external components like application code, Lambda @ Edge, Amazon CloudFront, AWS WAF etc. to provide required capability to manage HTTP Headers.

Starting last week AWS has enhanced Application Load Balancers with HTTP Header modification capabilities which will prove to be a game changer for many application hosting setups. The new capabilities allow Application Load Balancer to Insert / Rename HTTP Headers along with Disable capability to remove server:awselb/2.0 headers from response.

Steps to modify HTTP Headers in existing AWS ALB :

  • Login to your AWS Account
  • Navigate to the EC2 Console.
  • Under Load Balancing, click Load Balancers.
  • From list of load balancers, select desired Application Load Balancer
  • Under Listeners and rules, select desired Listener to modify
select Listener to modify
  • Navigate to Attributes section
Options to Add / Modify HTTP Headers under Attributes tab
  • Click on Edit
  • To Modify header names, Expand first option
  • List of header added automatically but ALB are shown, you can modify these header names to user-friendly / application identifiable names as needed
  • To Add response headers, Expand second option
  • Select the modify the header values as desired and it will be added to all responses from target before responding to origin

Please Note : If the HTTP response from your load balancer’s target already includes a header, the load balancer will overwrite it with the configured value.

  • To Disable “awselb/2.0” value in response header, expand third option

Similar settings can now be applied when creating a new AWS ALB

Other options to manage HTTP Headers on AWS ALB :

  • HTTP Header settings on ALB can also be manages on CLI commands
aws elbv2 modify-listener-attributes \
--listener-arn ARN \
--attributes Key="", Value=""

Conclusion :

By using these new capabilities of HTTP header modification in AWS ALB itself, dependency of managing commonly used headers using application code, Lambda @ Edge, Amazon CloudFront, AWS WAF etc. is removed / reduced. Applications using Lambda @ Edge or CloudFront just for managing these headers can save a lot of cost by managing them directly in ALB.

Also, such enhancements reasserts AWS commitment towards listening feedback and introducing capabilities / features to support workloads in most efficient ways.

--

--

Ravi Intodia
Ravi Intodia

Written by Ravi Intodia

Solution Architect working on designing and implementing AWS Cloud based solutions.

No responses yet