Question

I have two applications. One of which is going to handle authentication across a range of products. Because of this, from each one I want to rewrite a URL from each individual website to our "authentication" project. It would look something like this.

http://www.mywebsite.com/api/profile/login -> http://www.myauthentication.com/api/profile/login.

So essentially pushing the request cross domain.

For this I have setup ARR and URL Rewriting in IIS. However I can't seem to get it to work, and I have a feeling URL Rewriting is not running on requests that would normally cause a 404. I think this because on a REDIRECT request (301 redirect), the config works perfectly. When I use a rewrite, I get a generic 404 page.

The rules configuration looks as per below :

<rules>
    <rule name="Route the requests for the Profile API." enabled="true" stopProcessing="true">
      <match url="^profiles/(.*)" />
      <action type="Rewrite" url="http://authentication.local/api/profiles/{R:1}" logRewrittenUrl="true" />
    </rule>
</rules>

It should be noted that I am using the WebAPI, not MVC, which I'm not sure if that is causing issues or not. Because the redirect works but not the rewrite, I'm sure I've got everything installed OK in IIS.

For ARR, I have simply ticked "Enable Proxy" but I am unsure if I need to do anything else.

Was it helpful?

Solution

I managed to solve this by adding an ignore route for ARR.

RouteTable.Routes.IgnoreRoute("api/profiles/{*pathInfo}");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top