Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

A server is not dynamically compressing js and css files. What is weird though is that when this is tested on 3 other servers it works fine

What happens is that the Requests in all environments specify they accept GZIP encoding, but the difference is that the output on the server does not specify GZIP Content Encoding but the other enviroments do.

We have a dynamic script which is setting the content and the content encoding, and again this is working fine in all environments barring this one server. So I am thinking this is an IIS Issue. On that I have physically copied the compression elements from the MetaBase.xml on the server that is not working and pasted them into my local machine to try and replicate and cannot.

Every setting looks as it should to enable the compression but for whatever reason on this server it is not taking notice to the Response Header being added which is as follows:

"Content-encoding", "gzip"

TIA

Andrew

share|improve this question
add comment

1 Answer 1

Simply setting the Response header via script doesn't do anything to "turn on" compression. It just adds the header, which you don't want to do. IIS should add the header itself when it compresses.

You need to enable compression at the IIS layer for both dynamic and static assets. You can turn this on through the UI at the web server level, and refine the settings in the metabase. By default, on IIS6, only ASP, EXE, and DLL files have their output compressed when you enable dynamic compression. Note the conspicuous absence of ASPX!

Here is the metabase configuration I use for compresion on IIS6 (some values set via UI, others hand-edited).

    <IIsFilter  Location ="/LM/W3SVC/Filters/Compression"
    >
</IIsFilter>
<IIsCompressionScheme   Location ="/LM/W3SVC/Filters/Compression/deflate"
        HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
        HcCreateFlags="0"
        HcDoDynamicCompression="TRUE"
        HcDoOnDemandCompression="TRUE"
        HcDoStaticCompression="TRUE"
        HcDynamicCompressionLevel="4"
        HcFileExtensions="htm
            html
            txt
            css
            js
            xml"
        HcOnDemandCompLevel="10"
        HcPriority="1"
        HcScriptFileExtensions="asp
            aspx
            dll
            exe"
    >
</IIsCompressionScheme>
<IIsCompressionScheme   Location ="/LM/W3SVC/Filters/Compression/gzip"
        HcCompressionDll="%windir%\system32\inetsrv\gzip.dll"
        HcCreateFlags="1"
        HcDoDynamicCompression="TRUE"
        HcDoOnDemandCompression="TRUE"
        HcDoStaticCompression="TRUE"
        HcDynamicCompressionLevel="4"
        HcFileExtensions="htm
            html
            txt
            css
            js
            xml"
        HcOnDemandCompLevel="10"
        HcPriority="1"
        HcScriptFileExtensions="asp
            aspx
            dll
            exe"
    >
</IIsCompressionScheme>
<IIsCompressionSchemes  Location ="/LM/W3SVC/Filters/Compression/Parameters"
        HcCacheControlHeader="max-age=86400"
        HcCompressionBufferSize="8192"
        HcCompressionDirectory="c:\temp\IIS_temp_compressed"
        HcDoDiskSpaceLimiting="TRUE"
        HcDoDynamicCompression="TRUE"
        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="FALSE"
        HcNoCompressionForRange="FALSE"
        HcSendCacheHeaders="FALSE"
    >
</IIsCompressionSchemes>
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.