Search code examples
iisurl-rewritinghttp-deleteiisnodehttp-put

URL Rewrite in case of verbs PUT and DELETE with iisnode


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).


Solution

  • 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.

    enter image description here

    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>