Developer forum
E-mail notifications
GZIP
Replies
http://engage.dynamicweb.dk/Forum-5.aspx?action=ShowThread&ThreadID=2590
Hi Nicolai,
Where is the thread you are linking to? I just get the "The page cannot be found" page.
Hi Rene,
To enable gzip compression, you only need to make a few changes to web.config (assuming that the site is hosted on IIS 7).
Static content (js, css, ...)
Add the following under system.webServer section in web.config
<httpCompression minFileSizeForComp="1024"> <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" /> <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="application/json" enabled="true" /> <add mimeType="*/*" enabled="false" /> </staticTypes> </httpCompression> <urlCompression doStaticCompression="true" />
Dynamic content
For dynamic compression, I will recommend that you use the HttpCompression module that is enabled in Dynamicwebs default web.config, because IIS compression can cause problems in the administration (maybe not anymore?).
Another option is to use IIS compression for the front end, but not the administration. You can do that by adding a different web.config to the admin folder.
The HttpCompression module (not IIS compression) is set up to use deflate compression by default. To make it use gzip compression, you change the HttpCompressionPreferredAlgorithm setting under appSettings in web.config:
<add key="HttpCompressionPreferredAlgorithm" value="gzip" />
I have attached the modified web.config (DW 8 + IIS7).
For details about the IIS compression settings, have a look here: http://www.iis.net/configreference/system.webserver/httpcompression
/Morten
Has this ever been implemented so that we can choose whice filetypes to compress ? On standard Hostnordic hosted solutions that is? For us who don't have access to fiddling with the web.config :-)
Just ran a check on a site I just created, it would save med 370kb if js, css and svg was compressed...
Hi Jacob
It has not. It requires IIS to be setup appropiately, but I've just started a task today to find out if we can have this setup for all websites as part of the distribution of DW.
Will keep you posted.
Cool! :-)
My 2 cents...
I think the best way to accomplish this is to have appropriate default settings in applicationHost.config (app host level) and allow overrides in web.config (application level) - at least on dedicated servers.
I've had some issues with this on HN servers, because by default most overrides are denied in web.config (settings are ignored), so I had to modify applicationHost.config in order to get gzip compression on all static files and various other stuff.
As an example, the correct MIME type for .svg files is image/svg+xml, which is not gzip compressed when using the default settings in IIS. Usually, you can't change this behaviour by simply modifying web.config, because overrides are denied :/
What I usually do (on dedicated servers) is...
1) Allow overrides in applicationHost.config
BEFORE:
<section name="httpCompression" allowDefinition="AppHostOnly" overrideModeDefault="Deny" />
AFTER:
<section name="httpCompression" allowDefinition="MachineToApplication" overrideModeDefault="Allow" />
2) Modify web.config to include appropriate default settings, more or less the ones used in H5BP web.config. Those default settings could be added to applicationHost.config instead.
3) Add a few lines in web.config, in order to avoid a broken DW administration (reverting any setting that causes problems)...
<configuration>
...
<location path="Admin">
<system.webServer>
... revert settings ...
</system.webServer>
</location>
<location path="CustomModules">
<system.webServer>
... revert settings ...
</system.webServer>
</location>
</configuration>
BR, Morten
Hi Morten
Thank you for the great input! I will discuss this with Hostnordic and team and see if we should add some of this to our default web.config.
Thanks again, Nicolai
Hi Nicolai,
I am not sure if the subject in this thread has been resolved, so all DW-solutions can benefit from compressed files?
What is the status?
Still only through your hosting provider making the changes to applicationHost.config
BR Nicolai
Just to make sure I understand it, it is still only the solutions running on dedicated servers, on which we can make this adjustment to optimize the load process?
Not the ones running on shared servers (Free, Express, Standard)?
Hi Jens Jakob
Drop me a mail with the solution. Then I will take a look at this with support.
Problem with the SAAS servers is, that all customers shares installation and configuration. So if we make the changes, it will go for all customers on that box. Could be fine, but could also give some problems because solutions have not been tested with it. But we might be able to work around it.
So mail me, and we will look into it.
BR Nicolai