I'm trying to get the new Brotli compression scheme working in IIS using "Brotli compression module for Microsoft IIS" by iisspeed.com.
The Brotli compression module itself works fine if I change the <httpCompression>
config section in applicationHost.config
to only have the Brotli module.
The problem is that I want to have both gzip and Brotli, and prefer Brotli
The documentation on iisspeed.com says to do this:
<httpCompression directory="path\to\temp\folder" minFileSizeForComp="50">
<scheme name="br" dll="path\to\iisbrotli.dll" />
<scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
...
</httpCompression>
However I have discovered that this does not work.
The browser (Chrome in this example) sends the following accept-encoding
header:
accept-encoding: gzip, deflate, sdch, br
This means the browser can accept Brotli encoding br
as well as gzip
. I want IIS to prefer br
over gzip
but there doesn't appear to be a way to prioritise each <scheme>
element in the config. I've tried changing the order in the .config file but it has no effect.
IIS always uses gzip
even though br
is supported and would be preferred because it's a smaller file size.
I have scoured Google to find that there used to be a priority setting for each compression scheme in IIS 6 but it seems to have been removed in IIS7+.
It's called HcPriority
and went into the IIS6 metabase XML file.
See the following links:
https://msdn.microsoft.com/en-us/library/ms525366(v=vs.90).aspx
https://blogs.iis.net/ksingla/changes-to-compression-in-iis7
https://forums.iis.net/t/1150520.aspx