0

I am trying to get URL re-writing working on a IIS 8.5 server. I am having the same issue as described in this similiar post, that is a redirect works but rewrite does not.

The simple rule for testing purposes is:

            <rule name="ReverseProxy" stopProcessing="true">
                <match url="(.*)" />
                <action type="Rewrite" url="http://10.10.101.22:52797/{R:1}" />
            </rule>

My goal is to rewrite URLs with only specific path to another internal server.

If I change the rule to redirect it works. On a similarly configured IIS 8.5 server the rewrite rule works.

AAR is installed and Enable proxy is checked. After installing AAR I had to restart IIS for the AAR icon to appear. I could not see anything in Failed Request Tracing that explains why this is happening.
Does anybody have any suggestions?

haler
  • 3
  • 4
  • Are you sure you can change the host to another server with a rewrite? A redirect sends a response back to the client and causes it to reconnect -- a rewrite is supposed to continue processing in the same server -- it affects routing in further processing. – Lou Franco Oct 26 '17 at 13:31
  • To clear by not working I mean when the rule using rewrite, the rule is completely ignored. No rewrite or redirect occurs as if the rule was disabled. – haler Oct 26 '17 at 13:38
  • If I change the rule to redirect, the site is redirected to http://10.10.101.22:52797/ – haler Oct 26 '17 at 13:39
  • I don't know for sure, but I think this rewrite rule is not allowed (and therefore ignored). Do you have any documentation that shows that a non-redirected rewrite to another host is ok? A redirect works because the client makes a new request to the other host. This could only work if the server would make that request -- I don't know if that's ok – Lou Franco Oct 26 '17 at 13:58
  • On a similarly configured IIS 8.5 server the rewrite rule works. – haler Oct 26 '17 at 14:03
  • Is that IP/port reachable from that server? – Lou Franco Oct 26 '17 at 14:13
  • Yes 10.10.101.22 is accessible. As I said rewrite works in one environment but not the other. Something I am missing no doubt but what... – haler Oct 26 '17 at 14:19
  • Different environments can have different accessibility to an IP -- did you check from that server? – Lou Franco Oct 26 '17 at 14:23
  • Run wireshark on that server while it's supposedly redirecting and see if it makes network requests to 10.10.101.22 and what happens to them (do they succeed) – Lou Franco Oct 26 '17 at 14:25
  • I redeployed the mvc web application (and web.config) and re-added the rule on the server where the rewrite rule did not work and now it works. Not sure what the cause was. – haler Oct 26 '17 at 18:57

0 Answers0