Iis
當 POST 到靜態文件時,IIS 發送 200 而不是 405
我正在嘗試部署一個靜態網路速度測試應用程序。IIS 需要表現得像This Nginx Config。
一切正常,但我需要發送 200 而不是 405。執行上傳測試時。(對靜態文件的 POST 請求)
尋找 ISS 等效項,例如 Nginx “error_page 405 =200”
<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <staticContent> <mimeMap fileExtension=".webmanifest" mimeType="application/manifest+json" /> <mimeMap fileExtension="." mimeType="application/octet-stream" /> </staticContent> <urlCompression doStaticCompression="false" /> <httpProtocol> <customHeaders> <add name="Cache-Control" value="no-store, no-cache, no-transform, must-revalidate" /> </customHeaders> </httpProtocol> <caching enabled="false" enableKernelCache="false" /> <security> <requestFiltering> <verbs> <add verb="POST" allowed="true" /> <add verb="GET" allowed="true" /> </verbs> <fileExtensions> <add fileExtension="." allowed="true" /> </fileExtensions> <alwaysAllowedUrls> </alwaysAllowedUrls> <requestLimits maxAllowedContentLength="2147483647"/> </requestFiltering> </security> </system.webServer> </configuration>
您可以嘗試使用重寫規則。
match url
確保根據需要更改指令:<rewrite> <rules> <rule name="customResponseCode"> <match url=".*" /> <action type="CustomResponse" statusCode="200" /> </rule> </rules> </rewrite>