I'm new to Salesforce and working on a Angular2 + SF web application. I'm serving my JS files via StaticResources.

main.js is quite big though (ng2 + app). I was planning to increase performance by using gzip compression. I'm able to upload .gz file to SF, but couldn't read its contents.

Is there any way to serve a .gz file via Static Resources? Any way to decompress it? Is it worth it?


1 Answer 1


Salesforce automatically applies compression to Static Resources. So there's no need for you to Gzip your Javascript files manually. You can just upload the originals.

In the screenshot below, you can see the compressed size for this JS file was 3.4KB, around half of the original 8.2KB. In the response headers, you can see the Content-Encoding: gzip header.

> GET https://c.na35.visual.force.com/resource/1480279804000/axios

< HTTP/1.1 200 OK
< Cache-Control: public
< Expires: Wed, 11 Jan 2017 20:51:22 GMT
< Content-Type: text/javascript;charset=UTF-8
< Last-Modified: Sun, 27 Nov 2016 20:50:04 GMT
< Content-Encoding: gzip
< Transfer-Encoding: chunked

Content compression of the response

  • yes but it would be nice to save on upload time
    – Aequitas
    May 18, 2018 at 0:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .