Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I disable gzip compression for flv files in IIS 7 with runAllManagedModulesForAllRequests set to true?

I have an ASP.NET 3.5 Website that is running on IIS 7 and I would like to have my static content (like css files, javascript files, etc) gzip compressed as well as my dynamic content (.net pages). The problem is that I need to make sure flv files (flash video files) are not gzip compressed because that causes problems with the flash video player I'm using, Flowplayer.

I've added the following line to my web.config which enables compression, but then my flv files are also being gzip compressed:

<urlCompression doStaticCompression="true" doDynamicCompression="true" />

I've tried to add the following to my web.config, but it did not change anything:

<httpCompression>
    <staticTypes>
        <remove mimeType="video/x-flv"/>
    </staticTypes>
    <dynamicTypes>
        <remove mimeType="video/x-flv"/>
    </dynamicTypes>
</httpCompression>

I have to turn off doDynamicCompression for the flv files not to be gzip compressed. I think that it is treating flv files as dynamic content because I have runAllManagedModulesForAllRequests="true" in my web.config (which I need for some of the things I'm doing with routing).

In summary, how do I disable gzip compression for flv files?

like image 328
Austin Avatar asked Nov 06 '22 04:11

Austin


1 Answers

I think the best thing to do is to manually manage what is getting gzip'd. Sometimes what is gzip'd can actually increase in size, like a swf, which is what I just ran into. Previously my application.config had this block in it, and after I removed the shockwave mime type swf's stopped compressing

<httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
        <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
        <dynamicTypes>
                <clear />
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="application/x-amf" enabled="true" />
                <add mimeType="application/json" enabled="true" />
                <add mimeType="application/json; charset=utf-8" enabled="true" />
                <add mimeType="application/x-shockwave-flash" enabled="true" /> <!-- notice the swf mime type -->
                <add mimeType="*/*" enabled="false" />
        </dynamicTypes>
        <staticTypes>
                <clear />
                <add mimeType="text/*" enabled="true" />
                <add mimeType="message/*" enabled="true" />
                <add mimeType="application/x-javascript" enabled="true" />
                <add mimeType="application/atom+xml" enabled="true" />
                <add mimeType="application/xaml+xml" enabled="true" />
                <add mimeType="application/x-shockwave-flash" enabled="true" /> <!-- notice the swf mime type -->
                <add mimeType="*/*" enabled="false" />
        </staticTypes>
    </httpCompression>

This is in my application config in windows\system32\intersrv\config\application.config but I am pretty sure you can do this per website in your web.config under system.webserver.

All I had to do for me was to remove the shockwave mime type and it stopped getting compressed but all other valid mime types were.

like image 165
devshorts Avatar answered Nov 14 '22 23:11

devshorts