Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does AWS Application load balancer actually support compression?

My front-end code talks directly to the Application load balancer for my backend (using JSON over HTTPS).

I'm starting to retrieve more than trivial amount of data - so I thought I should work out what changes I had to make to support compressing the HTTP data.

I've come across a few posts stating that AWS load balancer compression is broken.

Example: https://medium.com/@sanjay.rajak/why-i-replaced-aws-elastic-load-balancer-to-haproxy-load-balancer-72207fad2d96

But as far as I can tell from the AWS documentation - ELB / ALB etc. don't actually support compression at all.

As a work-around, I can direct my backend calls through Cloudfront or API-gateway to get compression if I want - that's probably even the "right" way to do it, given that these services can also do some caching of requests, etc.

But before I go messing about with these other services - is it true that AWS load balancers don't support compression at all?

like image 761
Shorn Avatar asked Nov 02 '17 03:11

Shorn


2 Answers

I just tested this with an application running behind an Application Load Balancer. With gzip compression enabled on the server, the browser receives gzipped resources. The ALB correctly passes along the content-encoding: gzip HTTP header. Note that with ALB you also get HTTP/2 support which further reduces the time it takes for browsers to load your website's files.

I think that article you linked is incorrect, or out of date, or maybe it's an issue specific to Classic ELBs.

like image 191
Mark B Avatar answered Sep 20 '22 05:09

Mark B


You can use a Layer 4 Classic (ELB) or Network Load balancer. Since the Layer 4 load balancer is load balancing TCP traffic, ELB won't touch your HTTP headers or response.

Network Load Balancer FAQ

like image 26
Mark Mucha Avatar answered Sep 19 '22 05:09

Mark Mucha