question

MarcusSerrao-3051 avatar image
0 Votes"
MarcusSerrao-3051 asked SamWu-MSFT commented

URL Rewrite need to redirect and rewrite URL

HI,

I have an IIS 10 server, URL Rewrite, ARR 3.0, with two tomcat app servers on different servers (appserver1, appserver2). All traffic to my IIS servers must be directed via the URL Rewrite so my matching filter is "(.*)" for all rules.

I want users to be able to:
- go to "https://webserver1.acme.com/application" and hit "https://appserver1.acme.com/application"
- go to "https://webserver1.acme.com/application2" and hit "https://appserver2.acme.com/application"

Here is my rule set:


1)
<rules>
<rule name="Redirect to app server1" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{PATH_INFO}" pattern="^/application" />
</conditions>
<action type="Rewrite" url="https://appserver1.acme.com:9443/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>

2)
<rules>
<rule name="Redirect to app server2" stopProcessing="true">
<match url="(.*)" />
<conditions>
<add input="{PATH_INFO}" pattern="^/application2" />
</conditions>
<action type="Rewrite" url="https://appserver2.acme.com:9443/{R:1}" logRewrittenUrl="true" />
</rule>
</rules>

Doesn't seem to work. Any help? Thank you

windows-server-iis
· 8
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @MarcusSerrao-3051 ,

I think you can use {REQUEST_URI} not {PATH_INFO} in conditions, it's better that PATH_INFO.

Doesn't seem to work. Any help?

Please use failed request tracing to check why these rules cannot work. The trace log can show you what happened during rewrite and which step failed. If the log shows that rewrite success, then check ARR if it forward correctly.


1 Vote 1 ·

Thanks I'll take a look at those two things

0 Votes 0 ·

Hi @MarcusSerrao-3051 ,

If you have any problem using failed request tracing to troubleshoot url rewrite, you can post it.

0 Votes 0 ·
Show more comments

0 Answers