How can I enable IIS7 to gzip static files like js and css and how can I test if IIS7 is really gziping them before sending to the client?
Thanks!
How can I enable IIS7 to gzip static files like js and css and how can I test if IIS7 is really gziping them before sending to the client? Thanks! |
||||
|
This is another good link and showing you how to verify using fiddler. |
||||
|
ConfigurationYou can enable GZIP compression entirely in your
TestingTo test whether compression is working or not, use the developer tools in Chrome or Firebug for Firefox and ensure the HTTP response header is set:
Note that this header won't be present if the response code is 304 (Not Modified). If that's the case, do a full refresh (hold shift or control while you press the refresh button) and check again. |
|||||||||||||||||
|
Global Gzip in HttpModule If you don't have access to the final IIS instance (shared hosting...) you can create a HttpModule that adds this code to every HttpApplication.Begin_Request event :
Testing Kudos, no solution is done without testing. I like to use the Firefox plugin "Liveheaders" it shows all the information about every http message between the browser and server, including compression, file size (which you could compare to the file size on the server). |
|||||||||||
|
Here's a nice post on the topic.. http://www.coderjournal.com/2008/04/iis-7-compress-javascript-gzip/ |
|||||
|
Another really nice tool from google is Page Speed with Firebug http://code.google.com/speed/page-speed/ |
|||
|
Try Firefox with Firebug addons installed. I'm using it; great tool for web developer. I have enable Gzip compression as well in my IIS7 using web.config. Have a look at How to Gzip on Asp.Net and Godaddy Thanks. |
|||
|
This explains compression in IIS7 : http://blogs.iis.net/ksingla/archive/2006/06/13/changes-to-compression-in-iis7.aspx ..and for testing, I find Safari's Network Timeline tool gives nicely displayed info about what the browser is receiving from the server. It will actually show warnings/hints telling you if you are not using compression. |
|||
|
If you use YSlow with Firebug and analyse your page performance, YSlow will certainly tell you what artifacts on your page are not gzip'd! |
|||
|