IIS7+ 能否配置为在重定向到不同 url 期间保留 http 方法的类型

Can IIS7+ configured to retain the type of http-method during redirecting to different url

在 IIS7+ 服务器和 web.config 设置方面是否有足够的专家来说明是否可以配置 IIS 服务器在重定向到不同 url 时保留 http 方法(动词) - 在page-not-found-error 404 的情况,典型的 httpErrors 通过 web.config?

处理
  <system.webServer>
    <directoryBrowse enabled="false"/>  
    <httpErrors errorMode="Custom">
      <remove statusCode="404" subStatusCode="-1"/>
      <remove statusCode="403" subStatusCode="-1"/>
      <error statusCode="404" path="/restApp/config/restMappings.asp" 
     responseMode="ExecuteURL"/>
      <error statusCode="403" path="/restApp/config/restMappings.asp" 
      responseMode="ExecuteURL"/>
     enter code here</httpErrors>
   </system.webServer>

问题是这种重定向通常会将 http 方法更改为 GET 方法,而不管原始请求方法如何,例如 POST 或 DELETE。因此,在服务器变量中,重定向后始终只有 GET。是否有可能以某种方式在重定向后保留原始的 http 方法,以便它在相应的服务器变量中可用?

我在 restful api 的经典 asp 场景中需要这个。

您可以使用 HTTP 代码 307 Temporary Redirect 在重定向期间维护 HTTP 方法。

Response.Status = "307 Temporary Redirect"
Response.AddHeader "Location", "http://www.example.com/"