Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does minFileSizeForComp httpCompression attribute even work?

Tags:

asp.net

iis-7

Has anyone got the

<httpCompression minFileSizeForComp="XXX">

setting to be honored by IIS 7.x? The documentation here, http://www.iis.net/ConfigReference/system.webServer/httpCompression#005, states

Optional uint attribute. Specifies the minimum number of kilobytes a file must contain in order to use on-demand compression. The default value for IIS 7.5 is 2700; for IIS 7.0 the default value was 256.

I think the documentation meant bytes and not kilobytes. Could you imagine only HTTP compressing a response when it is 2.7 MB or greater?

I tried setting this value in the ApplicationHost.config and web.config with no affect.

like image 662
evermeire Avatar asked Nov 23 '11 23:11

evermeire


2 Answers

IIS definitely respects the minFileSizeForComp setting. However if both dynamic and static compression is enabled then the small file may be compressed by dynamic compression. I wrote a blog post about it and shared the troubleshooting steps using the Failed Request Tracing rules and provided a solution / workaround for this behavior. Please find it in the following link:

Enlightining a mystery with Failed Request Tracing: does IIS not respect the minFileSizeForComp setting for static compression https://blogs.msdn.microsoft.com/amb/2016/05/23/iis-respects-minfilesizeforcomp-for-static-compression/

Hope that helps someone.

-- AMB

like image 104
ahmetmithat Avatar answered Nov 05 '22 13:11

ahmetmithat


I know I'm very late here, but I did some experiments around this issue and have determined that the value is measured in kilobytes. This seems insane, but it's true.

I made a blog post with a little more detail here.

EDIT: Hmm, the issue doesn't seem to be quite this simple. IIS seems to refuse to compress files below a certain size regardless of what is selected.

like image 21
Joshua Walsh Avatar answered Nov 05 '22 13:11

Joshua Walsh