views:

177

answers:

3

i enable gzip for javascript file in my iis settings, here 's the corresponding config section.

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

currently, when i download my js file, it seems that sometimes server return the gzip one, and sometimes not. i dont know why, and how to debug that.

If a file is already gzipped, it should be cached in local disk, and next time someone visit that file again, iis kernel should return the cache gzip file directly without compressing it again. Is that right?

A: 

Clear your browser cache, and try again.

Delan Azabani
there's nothing about client cache. it's all about the server
Kevin Yang
A: 

I am experiencing this as well in IIS7.

I'm aware IIS makes decisions about when to gzip compress files based on size of the file, load on the server, etc.

But is there a way to ALWAYS force gzip compression on files with a specific extension or matching an appropriate MIME type regardless of conditions of the server ?

JAF
A: 

hi, jaf, i figure it out myself, there might be some bug in iis. you can set the frequenthitthreshold option to force the script file to always gzip the file. i write a post about this bug, but it's in chinese, here 's the google translated version Why gzip not work in IIS7?

Kevin Yang