My production setup is as follows:
- M1 – ASP.NET Website
- M2 - IIS URL Rewrite 2.0 + ARR 3.0
Using IIS URL Rewrite, any request to M2, say http://m2/app/login.aspx will be redirected to M1 as http://m1/app/login.aspx.
On M1, ASP.NET Open Auth has been implemented on the website to use Google external authentication. When user clicks the Google button, the browser will be redirected to the Google login page to allow the user to authenticate.
But when the website is accessed from M2, the redirection url generated by .net oAuth(https://accounts.google.com/[query-string]) to redirect to Google, is being replaced by URL Rewrite as http://m2/[query-string].
So just to be clear; when the request is made to authenticate via an external authentication provider a 302 redirect is returned. Often the form of this may look like:
Response Headers:
...
Location: https://accounts.google.com/o/oauth2/auth?big_long_query_string
...
This redirect is created by a server (M1) that sits behind the proxy server (M2 - IIS URL Rewrite 2.0 + ARR 3.0). So the rewrite server rewrites the Location header to:
Response Headers:
...
Location: http://M1/o/oauth2/auth?big_long_query_string
...
What we need is a rule that does not rewrite the location URL on redirection. It can only target certain redirects as well. Most of the time the behaviour mentioned here is wanted as all redirects are redirected to the main proxy server. Can someone suggest a solution or workaround for certain redirects?