首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >IIS在发送到静态文件时发送200而不是405

IIS在发送到静态文件时发送200而不是405
EN

Server Fault用户
提问于 2022-05-14 10:57:03
回答 1查看 266关注 0票数 1

我正在尝试部署一个静态网络速度测试应用。IIS需要表现得像这个Nginx Config

一切正常,但我需要发送200,而不是405。运行上传测试时。(将请求发送到静态文件)

寻找类似于Nginx "error_page 405 =200“的国际空间站等价物

代码语言:javascript
复制
<?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>
EN

回答 1

Server Fault用户

回答已采纳

发布于 2022-05-14 18:33:53

你可以用鲁鲁特规则来试试。确保根据需要更改match url指令:

代码语言:javascript
复制
<rewrite>
    <rules>
        <rule name="customResponseCode">
            <match url=".*" />
            <action type="CustomResponse" statusCode="200" />
        </rule>
    </rules>
</rewrite>
票数 0
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1100931

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档