Skip to content

Latest commit

 

History

History
148 lines (96 loc) · 10.7 KB

readme.md

File metadata and controls

148 lines (96 loc) · 10.7 KB

Brotli

Latest Release Downloads


Note: After this project was created, Microsoft released their own new compression plugin for Brotli and even borrowed my workaround for Accept-Encoding priority. You may wish to use that plugin instead.

Brotli IIS Compression Scheme Plugin

Brotli is a new-ish open-sourced compression algorithm specifically designed for HTTP content encoding. The algorithm and reference encoder/decoder libraries were created by Google.

Brotli offers significantly better compression than gzip with very little additional compression cost and almost no additional decompression cost.

This plugin is a very thin wrapper around Google's Brotli encoding library. There is no license management code, no automagic configuration, no unnecessary processing. This plugin contains only what is absolutely necessary to cleanly and reliably integrate Google's Brotli encoder with IIS's built-in Static and Dynamic Compression Modules.

Of course, that means you have to configure it yourself. But a proper HTTP compression design requires that you know what you're doing anyway, so this should not be a problem. If you're new to this, you may find the following links useful for learning about IIS compression and the configuration thereof.

Very little has changed since IIS 7 was released, but here's one more article highlighting some improvements to dynamic compression and compression config in IIS 10

Features

  • Integrates with the built-in IIS Static and Dynamic Compression Modules.
  • Uses the latest version of Google's Brotli encoder (v1.1.0).

Requirements

IIS 7 or later (Windows Vista/Windows Server 2008). You must have admin permissions to modify the root applicationHost.config file.

Installation

The Brotli IIS Compression Scheme Plugin is packaged as a single DLL file per platform architecture, with no external dependencies. The simplest way to install it is to copy it to your inetsrv folder, alongside the built-in gzip.dll. This allows configuration for Brotli to mirror the built-in schemes and allows for easy support of both 64-bit and 32-bit Application Pools.

Binaries are available on the releases page. A sample installation script is included in the .zip file.

The Compression Scheme must be registered in the applicationHost.config file. You can do this manually or with appcmd.exe or IIS Manager. Final configuration will look something like this:

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
    <scheme name="br" dll="%windir%\system32\inetsrv\brotli.dll" dynamicCompressionLevel="5" staticCompressionLevel="11" />
    <scheme name="gzip" dll="%windir%\system32\inetsrv\gzip.dll" dynamicCompressionLevel="4" staticCompressionLevel="9" />
    <staticTypes>
        <add mimeType="text/*" enabled="true" />
         ...
    </staticTypes>
    <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        ...
    </dynamicTypes>
</httpCompression>

Note that the name br shown above is important. This name must match the Accept-Encoding header value sent by the client and will be returned to the client in the Content-Encoding header. br is the official designator for Brotli.

Note also that if you need to support 32-bit Application Pools on 64-bit IIS, you will need to deploy the x64 version of the DLL to %windir%\system32\inetsrv and the x86 DLL to %windir%\syswow64\inetsrv. The WoW64 subsystem will automatically load the correct platform version of the DLL if its path is listed under system32 in the applicationHost.config, just as it does with