Enabling gzip compression on Azure App Service

前端 未结 1 613
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-02-08 07:03

I have a web app hosted in microsoft azure. As local IIS uses compression for both static and dynamic content I expected this to work on azure platform as well. As it seems comp

相关标签:
1条回答
  • 2021-02-08 07:50

    You can change this in the web.config:

    <system.webServer>
      <urlCompression doStaticCompression="true" doDynamicCompression="true" />
    </system.webServer>
    

    Then:

    <httpCompression>
      <dynamicTypes>
        <clear />
        <add enabled="true"  mimeType="text/*"/>
        <add enabled="true"  mimeType="message/*"/>
        <add enabled="true"  mimeType="application/x-javascript"/>
        <add enabled="true"  mimeType="application/javascript"/>
        <add enabled="true"  mimeType="application/json"/>
        <add enabled="false" mimeType="*/*"/>
        <add enabled="true"  mimeType="application/atom+xml"/>
        <add enabled="true"  mimeType="application/atom+xml;charset=utf-8"/>
      </dynamicTypes>
      <staticTypes>
         <clear />
         <add enabled="true" mimeType="text/*"/>
         <add enabled="true" mimeType="message/*"/>
         <add enabled="true" mimeType="application/javascript"/>
         <add enabled="true" mimeType="application/atom+xml"/>
         <add enabled="true" mimeType="application/xaml+xml"/>
         <add enabled="true" mimeType="application/json"/>
         <add enabled="false" mimeType="*/*"/>
       </staticTypes>
     </httpCompression>
    

    source: Microsoft forum

    0 讨论(0)
提交回复
热议问题