Search code examples
httpcompressioniis-6gzipisapi

Does there exist an open source ISAPI filter allowing IIS6 to do HTTP compression?


I'm looking for an open source project of an ISAPI filter for IIS6 to do gzip/deflate compression of HTTP requests like the "HttpZip" filter at http://www.port80software.com/products/httpzip/


Solution

  • IIS6 does compression natively. You'll need to be able to edit the IIS metabase so take care and make backups and also allow for downtime of sites.

    These are the main sections in the metabase that control compression. You'll need to consider some of the flags depending on your setup, i.e.

    Do you want to compress Dynamic and Static content of just Static. What level of compression do you want (I've gone for 9 rather than 10)? Which file types do you want to compress?

    <IIsFilter  Location ="/LM/W3SVC/Filters/Compression">
    </IIsFilter>
    <IIsCompressionScheme   Location ="/LM/W3SVC/Filters/Compression/deflate"
        HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
        HcCreateFlags="0"
        HcDoDynamicCompression="FALSE"
        HcDoOnDemandCompression="TRUE"
        HcDoStaticCompression="TRUE"
        HcDynamicCompressionLevel="9"
        HcFileExtensions="htm
            html
            xml
            css
            txt
            rdf
            js"
        HcOnDemandCompLevel="9"
        HcPriority="1"
        HcScriptFileExtensions="aspx
            asp
            asmx
            asbx
            ashx
            axd
            php"
    >
    </IIsCompressionScheme>
    <IIsCompressionScheme   Location ="/LM/W3SVC/Filters/Compression/gzip"
        HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
        HcCreateFlags="1"
        HcDoDynamicCompression="FALSE"
        HcDoOnDemandCompression="TRUE"
        HcDoStaticCompression="TRUE"
        HcDynamicCompressionLevel="9"
        HcFileExtensions="htm
            html
            xml
            css
            txt
            rdf
            js"
        HcOnDemandCompLevel="9"
        HcPriority="1"
        HcScriptFileExtensions="aspx
            asp
            asmx
            asbx
            ashx
            axd
            php"
    >
    </IIsCompressionScheme>
    <IIsCompressionSchemes  Location ="/LM/W3SVC/Filters/Compression/Parameters"
        HcCacheControlHeader="max-age=86400"
        HcCompressionBufferSize="8192"
        HcCompressionDirectory="%windir%\IIS Temporary Compressed Files"
        HcDoDiskSpaceLimiting="FALSE"
        HcDoDynamicCompression="FALSE"
        HcDoOnDemandCompression="TRUE"
        HcDoStaticCompression="TRUE"
        HcExpiresHeader="Wed, 01 Jan 1997 12:00:00 GMT"
        HcFilesDeletedPerDiskFree="256"
        HcIoBufferSize="8192"
        HcMaxDiskSpaceUsage="99614720"
        HcMaxQueueLength="1000"
        HcMinFileSizeForComp="1"
        HcNoCompressionForHttp10="TRUE"
        HcNoCompressionForProxies="TRUE"
        HcNoCompressionForRange="FALSE"
        HcSendCacheHeaders="FALSE"
            >
        </IIsCompressionSchemes>
    

    Some helpful reference;

    http://www.microsoft.com/technet/

    http://weblogs.asp.net/owscott/

    http://omaralzabir.com/