IIS7 Compression CSS files only compressed when dynamic compression is enabled

Posted by Paul on Server Fault See other posts from Server Fault or by Paul
Published on 2010-11-10T14:18:16Z Indexed on 2012/03/25 23:31 UTC
Read the original article Hit count: 465

Filed under:

If anyone can help it would be appreciated. I would like to enable compression for static files within IIS7 (for the sake of simplicity I'll just refer to static css files for the time being).

The problem I'm getting is that css files are only compressed when both dynamic and static compression is enabled in IIS for the website. What I really want to achieve is css compression (static file) whilst leaving the dynamic (aspx) pages as uncompressed for the time being (to avoid unnecessary CPU load).

I am puzzled as to why just leaving 'static compression' enabled causes css files to be returned uncompressed.

My applicationHost.config file has not be altered and looks like this:

        <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
        <staticTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/javascript" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </staticTypes>
        <dynamicTypes>
            <add mimeType="text/*" enabled="true" />
            <add mimeType="message/*" enabled="true" />
            <add mimeType="application/x-javascript" enabled="true" />
            <add mimeType="*/*" enabled="false" />
        </dynamicTypes>
    </httpCompression>

The server-wide compression setting within IIS is set to 'Dynamic Disabled' and 'Static Enabled' from the Server > Features > Compression page.

The web-site compression setting (Server > Sites > MyWebsite > Features > Compression) is where I am enabling and disabling dynamic compression as detailed above.

Any help would be really help me get unstuck on this.

Thanks

© Server Fault or respective owner

Related posts about compression