1

How to configure so that browser fetches gzipped compressed files in angular cli project hosted in IIs?

I have set up gzipper in angular cli project and when I execute ng build && gzipper --verbose ./dist and host in IIS, I can see the gzipped file served through developer tools.

Production mode

But when I execute ng build --prod && gzipper --verbose ./dist, even though the gzipped files are created in the release, served files are still the normals ones not the compressed ones.

enter image description here

Is there any workaround for this or should this be configured in IIS?

  • first, disable the iis compression. add header "content-encoding: gzip" in the iis. add mime tyep which servers *.js.gz files. [link](https://gist.github.com/suhrab/552af7b3383706081fbe51c102c290d7) – Jalpa Panchal Aug 07 '19 at 05:26

1 Answers1

0

I figured that SSL needs to be enabled to get the compressed files. I noticed this in Chrome and Firefox. Brotli files were served somehow, but failed for gzip in localhost and when using an IP.

Tried configuring url-rewrite, but I could notice that the files served were compressed but the header content-encoding: gzip,br was not applied in the response, so then the browser was unable to decompress resulting an error. This was again due to absence of SSL.

You can use url-rewrite to serve the pre-compressed files. Refer this.