Static and dynamic content compression

Static content compression and dynamic content compression are features of the IIS. They compress content at site level. When enabled, each request for static or dynamic content that contains the Accept-Encoding: gzip or Accept-Encoding: deflate header causes the content to be compressed, as long as the compression scheme, specified in the header, is enabled in IIS. If the request does not contain this header, or the header specifies a compression scheme that is not enabled in IIS, the content is not compressed.

IMPORTANT: This IIS feature might break some HTTP modules that changes the response. You cannot use it with WebOptimizer.

Compress static content

You can compress responses to requests for static content. This way, when a client requests static content, such as .htm or .txt, it is compressed before it is served.

To enable static content compression, perform the following:

  1. Open your web.config file.
  2. Inside <system.webServer> tag, insert <urlCompression doStaticCompression="true" />
  3. Save and close the web.config file.

Compress dynamic content

You can compress responses to requests for dynamic content. This way, when a client requests dynamic content, such as ASP pages or ISAPI extensions, it is compressed before it is served.

RECOMMENDATION: Because dynamic compression consumes considerable CPU time and memory resources, we recommend using dynamic content compression on servers that have slow network connections, but large CPU resources.

NOTE: IIS does not cache compressed versions of dynamic content. If you have enabled output cache, you must compress dynamic content before it is cached.

  1. Open your web.config file.
  2. Inside <system.webServer> tag, insert 
    <urlCompression doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
  3. Save and close the web.config file.

NOTE: You can turn on both static and dynamic content compression using one tag in the following way: <urlCompression doDynamicCompression="true" doStaticCompression="true" dynamicCompressionBeforeCache="true" />

 

Was this article helpful?

Next article

SSL offloading