Does AWS Application load balancer actually support compression?

12,563

Solution 1

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

Solution 2

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.

Share:
12,563
Shorn
Author by

Shorn

LinkedIn: https://www.linkedin.com/in/shorntolley Bitbucket: https://bitbucket.org/shorn https://bitbucket.org/kopi-cloud/rabbit https://bitbucket.org/teregrinteam/teregrin https://bitbucket.org/gitversion/gitversion I also build and run: https://kopi.cloud - Kopi is an email forwarder that lets you hand out generated "burner" email addresses so websites or companies don't know your real address. Also lets you redirect any of those address as an RSS feed (useful for browsing messages at your leisure from sites like Github, StackOverflow, etc.)

Updated on June 20, 2022

Comments

  • Shorn
    Shorn almost 2 years

    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?