Reputation: 6377
I'm trying to rewrite office.domain.com/app1 requests to server3:81 using the rule below, but I'm getting a 404. I can browse to server3:81 just fine.
The Failed Request Tracing logs are available here, but they don't seem to reveal much.
I've also tried url="http://server3:81/{R:0}"
and url="http://server3:81/{R:1}"
(not sure why/what the difference is), but both produce the same result (404).
What am I doing wrong in my rule? (Warning: I'm pretty unhandy with RegEx just yet, but I'll do my best to understand your answer. I may have to ask for clarification.)
<rule name="App1" stopProcessing="true">
<match url="^app1" />
<action type="Rewrite" url="http://server3:81/" />
</rule>
Upvotes: 0
Views: 902
Reputation: 47219
There's a couple of things you might want to try, the first would be to change the regex
pattern to match the entire url you are replacing and capture the part you want to keep. The second suggestion would be to verify that your rewrite url is http
and not https
:
Method One: (regex change)
<rule name="App1" stopProcessing="true">
<match url="^.*/(app1)" />
<action type="Rewrite" url="http://server3:81/{R:1}" />
</rule>
Method Two: (regex + https + port change)
<rule name="App1" stopProcessing="true">
<match url="^.*/(app1)" />
<action type="Rewrite" url="https://server3:8080/{R:1}" />
</rule>
Method Three: (regex full url + relative rewrite)
<rule name="App1" stopProcessing="true">
<match url=".*" />
<action type="Rewrite" url="server3:81/app1" />
</rule>
Upvotes: 1