Doubts about gzip compression on IIS servers

Asked

Viewed 221 times

3

I have a question, I have accommodation in kinghost and before activating the support I would like to know if what happens is even a problem.

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

The content css and js is delivered with gzip, but not always. I noticed this when using the pagespeed of google and sometimes he informs that the content is not being compressed. So I used the Devtools of Chrome and updated the same page several times with the same css and js and I noticed that actually the server doesn’t always deliver these compressed files.

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

Thanks for your attention.

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

  • 1

    just to be sure, the times it does not deliver compressed status code is different than 304?

  • status is always 200

1 answer

0

Apparently, IIS does not compress every request. Enter the configuration below in the 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

  • tested, I thought q had solved, but again appeared the same file without compressing (sporadically)

Browser other questions tagged

You are not signed in. Login or sign up in order to post.