Reputation: 71
I am trying to use URL Rewrite and Application Request Routing to rewrite to an external URL. I have set up the following rule:
<rewrite>
<rules>
<rule name="RewriteExternal" enabled="true" stopProcessing="true">
<match url="patternToMatch/(.*)" />
<action type="Rewrite" url="http://100.100.100.100/{R:1}" appendQueryString="false" logRewrittenUrl="false" />
</rule>
</rules>
</rewrite>
In the rule, "patternToMatch" is the pattern I am trying to match, and the 100.100.100.100 server is the external server (outside our firewall) to which I am trying to rewrite. I have turned on logging and see that the pattern is matching, the URL is rewritten approropriately, but then I see "ARR_WEBFARM_NOT_ROUTED" with the 100.100.100.100 IP address. The request is then rewritten back to the orignal request and the request fails.
I understand that for internal redirects that I could add the internal server to the web farm, but this doesn't apply to external servers. Is it possible to rewrite to external servers? If so, how do I get around using the web farm and avoid the "ARR_WEBFARM_NOT_ROUTED" error?
Thanks for any help.
Upvotes: 4
Views: 2572
Reputation: 2828
FYI I know this is old but here's my two cents: ARR_WEBFARM_NOT_ROUTED may be a "false positive" as in my case I had two local IIS sites with identical rules for reverse proxy one worked and one did not. BOTH sites had the ARR_WEBFARM_NOT_ROUTED entry, I assume, because neither had any actual web farm entries, just the external sites (though the sites I was rewriting to were also local IIS sites).
In addition OP said "rewritten back", and that was ALSO in both my working and non-working sites logs, which mean it may not be a smoking gun either.
Turns out my problem was actually a conflict between ARR and MVC. I would have thought ARR was higher in the pipeline before MVC, but somehow MVC butts in and will try to route the original pre-rewritten URL thus causing 404's. I'm not sure of the exact cause but one fix was to tell MVC to ignore the rewrite URL's (either in global.asax.cs or RouteConfig.cs):
routes.IgnoreRoute("rewrite_path_here/{*pathInfo}");
Hope that helps someone.
Upvotes: 4