performance – Doubts about gzip compression on IIS servers

Question:

I have a question, I have hosting at kinghost and before calling support I would like to know if what is happening is really a problem.

what happens is that the static files (mostly in question the css and js ) are not always being delivered zipped.

The css and js content is delivered with gzip , but not always. I noticed this when using google's pagespeed and sometimes it reports that the content is not being compressed. So I used chrome's DevTools and updated the same page several times with the same css and js and noticed that the server really doesn't always deliver these compressed files.

Why does it happen? is this normal or a server configuration failure?

I thank the attention.

ps.: if relevant, the IIS OS version is 8.

Answer:

Apparently, IIS doesn't compress on every request. Enter the configuration below in web.config

<system.webServer>
        <serverRuntime frequentHitThreshold="1" enabled="true" />
        <staticContent>
              <clientCache cacheControlMode="UseMaxAge" cacheControlMaxAge="30.00:00:00" />
              <remove fileExtension=".svg" />
              <mimeMap fileExtension=".svg" mimeType="text/xml" />
        </staticContent>
        <httpCompression directory="%SystemDrive%\inetpub\temp\IIS Temporary Compressed Files">
            <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
            <dynamicTypes>
                <add mimeType="*/*" enabled="true" />
            </dynamicTypes>
            <staticTypes>
                <add mimeType="image/svg+xml" enabled="true" />
                <add mimeType="text/xml" enabled="true" />
                <add mimeType="*/*" enabled="true" />
            </staticTypes>
        </httpCompression>
        <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
    </system.webServer>

Source: https://serverfault.com/a/584534

Scroll to Top
AllEscort