使用iisnode对动词PUT和DELETE进行URL重写 [英] URL Rewrite in case of verbs PUT and DELETE with iisnode

查看:69
本文介绍了使用iisnode对动词PUT和DELETE进行URL重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的

直接在 web.config system.webServer 内部作为文本:

 < security>< requestFiltering><动词>< add verb ="PUT";allowed ="true"/>< add verb ="DELETE"allowed ="true"/></动词></requestFiltering></security> 

This is a follow-up question to my previous one, focused on the fact that I'm getting a 404 error when I try to call a DELETE or a PUT verb for an Node.JS application on IIS configured with iisnode and URL Rewrite as follows:

<handlers>
  <add name="iisnode" verb="*" path="app.js" modules="iisnode" />
</handlers>

<rewrite>
  <rules>
    <rule name="my app rule" stopProcessing="true" patternSyntax="Wildcard">
    <match url="*" />
    <action type="Rewrite" url="app.js" />
  </rule>
  </rules>
</rewrite>

The script app.js is not even called, the url is not rewritten.

Is it a well known bug or what else am I supposed to do?

No issues for GET and PUT verbs instead (and of course I've already implemented a workaround using the latter).

解决方案

That was due to the Request Filtering of IIS (tab HTTP Verbs)

Added there the missing verbs as shown in the screenshot below and problem solved.

As text, directly inside the system.webServer of the web.config:

<security>
    <requestFiltering>
        <verbs>
            <add verb="PUT" allowed="true" />
            <add verb="DELETE" allowed="true" />
        </verbs>
    </requestFiltering>
</security>

这篇关于使用iisnode对动词PUT和DELETE进行URL重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆