I have the following attribute to make sure the page of the remote site opens in https mode.
public class RemoteRequireHttpsAttribute : RequireHttpsAttribute { public override void OnAuthorization(AuthorizationContext filterContext) { if (filterContext == null) { throw new ArgumentException("Filter Context"); } if (filterContext != null && filterContext.HttpContext != null) { if (filterContext.HttpContext.Request.IsLocal) { return; } else { string val = ConfigurationManager.AppSettings["RequireSSL"].Trim(); bool requireSsl = bool.Parse(val); if (!requireSsl) { return; } } } base.OnAuthorization(filterContext); } }
Local development now works fine, since I donโt want it to open in https mode.
The Dev site opens the page in https mode - there is no problem (single node).
Where, how the site (load balancing - 2 nodes) that I am setting up right now gives me the following error. Please note that dev and prod sites have the same settings and web.config
Page not redirecting correctly
Firefox has detected that the server redirects the request to this address in a way that will never be completed.
This problem can sometimes be caused by disconnection or refusal to accept cookies.
Dev site url is similar to http://dev.datalab.something.org
Prod website URL is similar to http://datalab.something.org
And here is the challenge
[RemoteRequireHttps] public ActionResult Index(string returnUrl, string error)
What am I missing here?
Update 1: My administrator has confirmed that SSL termination has been configured at the balancer level. I browsed the iis site and I don't see the https bindings. I see only http bindings. Does he also need to configure https bindings?
Update 2: @AlexeiLevenkov pointed me in the right direction, and this post had the code I used, and it works. We moved the code into a separate answer.