I'm using IIS to reverse proxy HTTP requests to a nodejs app running in the same machine.
URL rewrite and ARR modules are installed and the proxy setting checked. The URL matching seems good: if I change the rule to redirect it works as expected. Using rewrite I get a 404 error.
The API endpoint is api.url.com/getContent/ofertas
. The IIS site root folder is W:\sites\LocalUser\site\api
. Here is the web.config
file.
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="UrlRewriteLocalhost" enabled="true" stopProcessing="true">
<match url="(.*)" />
<action type="Rewrite" url="http://localhost:8801/{R:1}" />
</rule>
</rules>
</rewrite>
<defaultDocument>
<files>
<remove value="index.htm" />
<remove value="index.html" />
</files>
</defaultDocument>
</system.webServer>
</configuration>
I'm sure that in the past I had similiar setup in another machine with a similar web.config
file. I've worked out problems in the past (mainly about FTP) using procmon and here are my findings:
Procmon screen shots
These are the procmon logs when I access the URL with the rewrite vs redirect rule. Notice that on the redirect rule the web.config
file is resolved in the correct path (red arrow). With the rewrite rule it seems that it can't be resolved to the correct path.
404 error with the rewrite rule
Adding to that, if I interpert the error description correctly it looks that it's not finding an appropriate file handler, because there is none set up. Also by looking at the 'PhysicalPath' it looks like it's requesting the wrong path, which makes sense backed up by the procmon logs.
I read somewhere that the URL rewriting comes before the handler mappings situation so does this mean that URL rewriting is not working properly? Where do I go next from here?