开发者

Static gzip compression with IIS 7 when using mod_jk

开发者 https://www.devze.com 2023-04-04 08:06 出处:网络
I have a web application running on JBoss and I am using IIS 7 for load balancing JBoss instances. Static files (ex: CSS, JS) are served from IIS. I am using mod_jk ISAPI filter to bridge IIS and JBos

I have a web application running on JBoss and I am using IIS 7 for load balancing JBoss instances. Static files (ex: CSS, JS) are served from IIS. I am using mod_jk ISAPI filter to bridge IIS and JBoss.

I have enabled static compression in IIS. However, the CSS files served from IIS were not getting gzip compressed (I have chec开发者_StackOverflow社区ked this by examining the response header and it doesnt have content-encoding: gzip header).

Post this, I enabled dynamic compression in IIS and then the CSS files were compressed with gzip. I checked my uriworkermap.properties file and it is not routing CSS file request to JBoss. I am puzzled as to why IIS wouldnt compress CSS files with static compression enabled and only compresses when dynamic compression is enabled.

Thanks, Kishor


This is probably a result of IIS deciding not to compress the content as it's not considered "frequently hit". If you request the file twice within 10 seconds (make sure you're not hitting a cache, ctrl-F5), does it then compress it?

If so, setting the frequentHitThreshold attribute to 1 on the system.webServer/serverRuntime node in the applicationHost.config file should do the trick, as documented at http://www.iis.net/ConfigReference/system.webServer/serverRuntime.

You can do this by executing the following command as an administrator:

%windir%\system32\inetsrv\appcmd set config /section:serverRuntime /frequentHitThreshold:1 /commit:apphost

A word of warning - the "frequent hit" concept does not seem specific to compression. I have no idea whether there are other consequences as a result of setting this!

0

精彩评论

暂无评论...
验证码 换一张
取 消