Score:0

IIS Send 200 Instead of 405 when POST to a Static File

se flag

I am trying to deploy a static network speed test application. IIS need to behave like This Nginx Config.

Everything working fine, but I need to send 200 instead of 405. When Running Upload Test. (POST request to a Static File)

Looking for ISS Equivalent like 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>
Score:0
cn flag

You can try it with rewrute rules. Make sure you change the match url directive according to what you need:

<rewrite>
    <rules>
        <rule name="customResponseCode">
            <match url=".*" />
            <action type="CustomResponse" statusCode="200" />
        </rule>
    </rules>
</rewrite>
user3642342 avatar
se flag
Yes, This worked. Added <match url="upload" />
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.