Laravel/Php - How to serve gzipped content from S3
As much as I researched, I found there is no out of the box gzip compression for the files on Amazon S3, Digital Ocean Spaces or Vultr Objects etc. So I decided to gzip compress the content of file on my server's end and then upload the compressed version to s3.
Here's what my code looks like now (Laravel Example)
The only thing I had to do was just use a simple Php function
gzencode() and send
ContentEncoding along with the put request.
As the result, the file size is now reduced by almost 40% and the app loads way faster than before.