HomePhabricator
Diffusion Comm 0a18f121e40b

[keyserver] Compress HTTP responses

Description

[keyserver] Compress HTTP responses

Summary:
This change enables the use of gzip and deflate compression "transparently" for all HTTP requests. It does so using Express's official compression library. Linear task: ENG-5018

  • iOS: iOS supports deflate but not Brotli, so this is the best thing we can do outside of the application layer.
  • Android: Android only supports gzip, so this is the best thing we can do outside of the application layer.
  • Web: Pretty much all modern browsers support Brotli now. I explored alternatives to compression that support Brotli here, but didn't find any that I felt great about.

I also considered implementing this on the application layer like I did for the socket. I ended up deciding against this given how much easier this approach was. More details here.

Test Plan: I tested iOS, Android, and Chrome using this patch. I also enabled debug output for compression by running the keyserver via DEBUG=compression yarn dev. I confirmed that all three were getting compressed responses when the response was sufficiently large. Android was a bit tricky because it was stripping the Content-Encoding header, but I was able to confirm it here.

Reviewers: atul, bartek, michal, kamil

Reviewed By: atul

Subscribers: tomek

Differential Revision: https://phab.comm.dev/D9305

Details

Provenance
ashoatAuthored on Sep 27 2023, 11:07 AM
Reviewer
atul
Differential Revision
D9305: [keyserver] Compress HTTP responses
Parents
rCOMM1e3a06e929d6: [keyserver] Pass `--performance-schema` to MariaDB in `docker-compose`
Branches
Unknown
Tags
Unknown