Is there a way to serve mapbox GL gzipped geojson files? I have style.json file that pulls multiple geojson files and it is pretty heavy.

2 Answers 2


Here is how you serve gzipped GeoJson files from CloudFront:

  1. Make sure the Content-Type of the geojson files is application/javascript (you can change it in S3)

  2. In CloudFront, under behavior, set Compress Objects Automatically to yes

Make sure you invalidate the folder before checking if it works.


Set the Content-Encoding: gzip header on your web server when serving the gzip files. Then the browser will transparently decompress.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.