azurecontent-encodingazure-storage-account

Azure Storage Account Static Website takes lot of time to load


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?


Solution

  • 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