| |

How to enable dynamic GZIP compression on Azure Web App

Go to the Kudu on Azure

First should go to Kudu on Azure. Please visit https://docs.microsoft.com/en-us/azure/app-service/resources-kudu to get more insights.

You can just add “scm” to your azure web app URL as follows.

https://<yourapp>.scm.azurewebsites.net

Find CMD console

Then, you should navigate to the CMD console:

Find the application Config folder

Click on the “Site root” icon to see all folders listening as follows:

Find applicationhost.config file

Go to the config folder and find applicationhost.config file

As you can see, you have some essential options, including download, edit and remove next to each file.

Enable dynamic compression inside applicationhost.config

Modify applicationhost.config file by clicking on the edit icon.

Inside <system.webServer> tag, you should have the following compression settings:

  <urlCompression doStaticCompression="true" doDynamicCompression="true" />
  <httpCompression directory="C:\local\IIS Temporary Compressed Files" noCompressionForProxies="false">
      <scheme name="gzip" dll="%Windir%\system32\inetsrv\gzip.dll" />
      <dynamicTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/atom+xml;charset=utf-8" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </dynamicTypes>
      <staticTypes>
        <add mimeType="text/*" enabled="true" />
        <add mimeType="message/*" enabled="true" />
        <add mimeType="application/x-javascript" enabled="true" />
        <add mimeType="application/javascript" enabled="true" />
        <add mimeType="application/atom+xml" enabled="true" />
        <add mimeType="application/xaml+xml" enabled="true" />
        <add mimeType="application/json" enabled="true" />
        <add mimeType="image/svg+xml" enabled="true" />
        <add mimeType="*/*" enabled="false" />
      </staticTypes>
    </httpCompression>

Make sure your data type is included and the app is restarted. Happy compression!

Similar Posts