We are excited to announce that the IIS.NET Forums are moving to the new Microsoft Q&A experience. Learn more >

Part of original url is lost using ARR / URL RewriteRSS

5 replies

Last post Feb 04, 2021 07:18 AM by samwu

  • Part of original url is lost using ARR / URL Rewrite

    Feb 02, 2021 10:08 AM|Emka|LINK

    Hi can somebody help me with this:

    I have the following rule:

    <rule name="InboundRule1" stopProcessing="true">
      <match url="^123456/(.*)" />
      <conditions>
        <add input="{CACHE_URL}" matchType="Pattern" pattern="^https://mywebsite\.mydomain\.com" ignoreCase="true" />
      </conditions>
      <action type="Rewrite" url="https://myinternalwebsite123456.mydomain.com/{R:1}" />
    </rule>

    Navigating to https://mywebsite.mydomain.com/123456/xxx perfectly takes me to the correct internal website, but in the response, the "123456/" part is lost from the url. So in the address area, https://mywebsite.mydomain.com/xxxx appears instead of https://mywebsite.mydomain.com/123456/xxxx. This of course causes the webapplication to fail.

    Does somebody know how to solve? 

  • Re: Part of original url is lost using ARR / URL Rewrite

    Feb 03, 2021 08:00 AM|samwu|LINK

    Hi Emka,

    Emka

    https://mywebsite.mydomain.com/xxxx appears instead of https://mywebsite.mydomain.com/123456/xxxx.

    Obviously there is a problem with your Pattern "^123456/(.*)". it can match both "xxxx" and "123456/xxxx".

    What is your request url? i can made demo for you.

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
  • Re: Part of original url is lost using ARR / URL Rewrite

    Feb 03, 2021 08:39 AM|Emka|LINK

    Hi Sam,

    thank you for answering, unfortunately I can't follow.

    How can the pattern "^12456/(.*)" match "xxxx"?

    Request url is https://mywebsite.mydomain.com/123456/xxx
    It should show up with a login form and the address bar of the browser should contain : https://mywebsite.mydomain.com/123456/Account/Login?returnUrl=%2Fxxx

    But instead it contains : https://mywebsite.mydomain.com/Account/Login?returnUrl=%2Fxxx

    I did not mention yesterday, but I have tried many outbound rules as well, all without success.

    Kind regards,

    Emka

  • Re: Part of original url is lost using ARR / URL Rewrite

    Feb 03, 2021 09:25 AM|samwu|LINK

    Hi Emka,

    Emka

    Request url is https://mywebsite.mydomain.com/123456/xxx
    It should show up with a login form and the address bar of the browser should contain : https://mywebsite.mydomain.com/123456/Account/Login?returnUrl=%2Fxxx

    But instead it contains : https://mywebsite.mydomain.com/Account/Login?returnUrl=%2Fxxx

    I did not mention yesterday, but I have tried many outbound rules as well, all without success.

    Have you tried clearing your browser's cache and then try again? Is it still the same problem?

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >
  • Re: Part of original url is lost using ARR / URL Rewrite

    Feb 03, 2021 10:36 AM|Emka|LINK

    Hi Sam,

    Yes, I cleared the browser cache and even tried driiferent browsers, all give the same result.

    Regards,

    Emka

  • Re: Part of original url is lost using ARR / URL Rewrite

    Feb 04, 2021 07:18 AM|samwu|LINK

    Hi Emka,

    Emka

    <action type="Rewrite" url="https://myinternalwebsite123456.mydomain.com/{R:1}" />

    Emka

    It should show up with a login form and the address bar of the browser should contain : https://mywebsite.mydomain.com/123456/Account/Login?returnUrl=%2Fxxx

    But instead it contains : https://mywebsite.mydomain.com/Account/Login?returnUrl=%2Fxxx

    This rule does not match the URL, can you show me your complete request process?

    Best regards,

    Sam

    IIS.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today. Learn more >