1

I have a node/express app that has special URL characters in it's route. For example, the route would be /urlinspect/https://example.com

This works without issue when I run it locally but when I attempt to run it through IIS with ARR/Reverse Proxy it fails to handle the URL properly. I had already added the useOriginalURLEncoding="false" to my Web.config and set the useOriginalURLEncoding to false in both the system.webServer/rewrite/rules and system.webServer/rewrite/globalrules paths of configuration within IIS.

<configuration>
    <system.webServer>
        <rewrite>
            <rules useOriginalURLEncoding="false">                  
                <rule name="ReverseProxyInboundRule1" stopProcessing="true">
                    <match url="(.*)" />
                    <action type="Rewrite" url="http://localhost:3000/{R:1}" />
                </rule>
            </rules>
        </rewrite>
        <security>
            <requestFiltering allowDoubleEscaping="false" />
        </security>
    </system.webServer>
</configuration>
Kode
  • 3,073
  • 18
  • 74
  • 140
  • 1
    You can use [failed request tracking](https://learn.microsoft.com/en-us/iis/extensions/url-rewrite-module/using-failed-request-tracing-to-trace-rewrite-rules) to view detailed error information. – samwu Jun 15 '21 at 05:52
  • From what I can see it is not encoding the URL as a parameter. I have tried so many variations of rewrite URLs but can't seem to get the right combination yet (ex. {UrlEncode:{R:1}} for the parameter – Kode Jun 21 '21 at 21:10
  • 1
    Have you tried https://stackoverflow.com/a/54333002/8389235 ? – Daniel Klischies Jun 22 '21 at 20:08
  • Will give that iteration a go. Its the condition of encoding where I have been testing – Kode Jun 22 '21 at 20:31
  • That worked @DanielKlischies, the thing I was missing was Unencoded_URL part as I was trying EncodeURL: as well as not getting the pathing correct. Can you post an answer so I can provide the bounty award? – Kode Jun 23 '21 at 16:12
  • Have you tried using failed request tracking? – samwu Jun 25 '21 at 09:41
  • It is already solved per the link @DanielKlischies provided – Kode Jun 25 '21 at 19:28

0 Answers0