2

我的 Azure Webapps 中的 gzip 有问题。我正在使用 Wordpress(我的域是https://www.uc.ac.id)并为我的 Web 应用程序使用 Windows 操作系统基础。

我无法在我的站点中启用 gzip 压缩。我尝试了很多方法来启用它(在我的 web.config 和 application.xdt 上添加压缩),但是在我签入https://checkgzipcompression.com后它不起作用,gzip 未启用。

请帮我。

有我的 web.config

 <?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.web>
   <pages enableSessionState="false" />
</system.web>
  <system.webServer>
      <httpProtocol>
      <customHeaders>
        <clear />
        <remove name="X-Powered-By" />
        <add name="X-Frame-Options" value="SAMEORIGIN" />
        <add name="X-Xss-Protection" value="1; mode=block" />
        <add name="X-Content-Type-Options" value="nosniff" />
        <add name="Referrer-Policy" value="no-referrer" />
      </customHeaders>
      <redirectHeaders>
        <clear />
      </redirectHeaders>
    </httpProtocol>
    <security>
        <requestFiltering>
             <requestLimits maxAllowedContentLength="15000000" />
             <denyUrlSequences>
                <add sequence="xmlrpc.php" />
             </denyUrlSequences>
       </requestFiltering>
      <dynamicIpSecurity denyAction="Forbidden">
       <denyByConcurrentRequests enabled="true" maxConcurrentRequests="10" />
       <denyByRequestRate enabled="true" maxRequests="15" requestIntervalInMilliseconds="2000" />
     </dynamicIpSecurity>
    </security>
    <staticContent>
            <clientCache cacheControlCustom="public" cacheControlMode="UseMaxAge" cacheControlMaxAge="31.00:00:00" />
            <remove fileExtension=".woff2" />
            <mimeMap fileExtension=".woff2" mimeType="font/woff2" />
            <remove fileExtension=".woff" />
            <mimeMap fileExtension=".woff" mimeType="font/woff" />
    </staticContent>
    <urlCompression doStaticCompression="true" doDynamicCompression="true" dynamicCompressionBeforeCache="true" />
      <rewrite>
      <rules>
        <rule name="ProxyAdmin" stopProcessing="true">
            <match url="developer-academy(.*)" />
            <action type="Rewrite" url="https://ucappleacademy.azurewebsites.net/{R:1}" logRewrittenUrl="false" />
        </rule>
        <rule name="Redirect rquests to default azure websites domain" stopProcessing="true">
            <match url="(.*)" />  
            <conditions logicalGrouping="MatchAny">
              <add input="{HTTP_HOST}" pattern="^semeru\.azurewebsites\.net$" />
            </conditions>
            <action type="Redirect" url="https://www.uc.ac.id/{R:0}" />  
        </rule>
            <rule name="WordPress: https://www.uc.ac.id" patternSyntax="Wildcard">
                <match url="*"/>
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
                    </conditions>
                <action type="Rewrite" url="index.php"/>
            </rule>
            </rules>
    </rewrite>
  </system.webServer>
</configuration>

这是我的 application.xdt

    <?xml version="1.0"?>  
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">  
    <system.webServer>  
        <proxy xdt:Transform="InsertIfMissing" enabled="true" preserveHostHeader="false" reverseRewriteHostInResponseHeaders="false" />  
        <httpCompression>
            <dynamicTypes>
                <add mimeType="application/json;charset=utf-8" enabled="true" xdt:Transform="InsertAfter(/configuration/system.webServer/httpCompression/dynamicTypes/add[(@mimeType='application/json')])" />
                </dynamicTypes>
        </httpCompression>
    </system.webServer>  
</configuration>
4

0 回答 0