1

I have deployed my Single Page Applicate built in Angular in Azure Storage Account Static Website. But it takes lot of time to load the website initially. After investigation I found that it takes about 1.2 min to load one js file - main.af203c3f3d3f3672aa00.js which is only 4.8MB in size. Also in the response header I can see only the below headers -

Accept-Ranges: bytes
Content-Length: 4787902
Content-MD5: n+dgJsZM2T10m0hxWEpjJw==
Content-Type: text/javascript
Date: Tue, 21 Jul 2020 13:06:45 GMT
ETag: "0x8D82CBF6D4B3910"
Last-Modified: Mon, 20 Jul 2020 15:13:15 GMT
Server: Windows-Azure-Web/1.0 Microsoft-HTTPAPI/2.0
x-ms-request-id: 6ea1da4a-e01e-0045-0b5f-5f06fe000000
x-ms-version: 2018-03-28

The Content-Encoding: gzip this is not set. Which is why it is taking this much time to download the content of 4.8MB.

I have checked in the azure portal, did not find any option to enable the Content-Encoding. How can I enable the compression for Static Website in Azure Storage Account?

Sibaprasad Maiti
  • 507
  • 8
  • 19

1 Answers1

2

Using Azure Storage Explorer you can set content-type, cache-control, content-encoding on each blob. Convert your .js file to .gzip and then set the correct metadata on the file.

Here is an online tool that can convert javascript to gzip: http://cnvyr.io/online

enter image description here

Daniel Björk
  • 2,475
  • 1
  • 19
  • 26
  • 1
    It worked. I have gzipped the file keeping the same name and uploaded. Then change the `ContentEncoding: gzip` using the azure storage explorer. The file which was taking 1.2 min to download before can be downloaded in less than 20s now. – Sibaprasad Maiti Jul 22 '20 at 10:37
  • 1
    you need to change the "ContentEncoding" for each file or to $web container? Can make this change from Azure web portal or only from Azure Storage explorer app? – Pablo Sanchez Manzano Jun 29 '21 at 20:24
  • 1
    Ohh!!! "keeping the same name" do you means i need to remove ".gz" extension??? – Pablo Sanchez Manzano Jun 29 '21 at 21:03