title: Remote Require HTTPS MVC 5
body: <p>I have the following attribute to make sure that the remote site page opens in https mode.</p>
  
  <pre><code>public class RemoteRequireHttpsAttribute : RequireHttpsAttribute
      {
          public override void OnAuthorization(AuthorizationContext filterContext)
          {
              if (filterContext == null)
              {
                  throw new ArgumentException("Filter Context");
              }
  
              if (filterContext != null &amp;&amp; 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);
          }
      }
  </code></pre>
  
  <p>Local development now work normal since i don't want it to open in https mode. </p>
  
  <p>Dev site opens the page in https mode - no issues here (single node). </p>
  
  <p>Where as the production (load balanced - 2 nodes) site that i am currently setting up is giving me following error. Please note that dev and prod sites have the same setings and web.config</p>
  
  <blockquote>
    <p>The page isn't redirecting properly</p>
    
    <p>Firefox has detected that the server is redirecting the request for this address in a way that will never complete.</p>
    
    <p>This problem can sometimes be caused by disabling or refusing to accept cookies.</p>
  </blockquote>
  
  <p>Dev site url is like
  <a href="http://dev.datalab.something.org" rel="nofollow">http://dev.datalab.something.org</a></p>
  
  <p>Prod site url is like 
  <a href="http://datalab.something.org" rel="nofollow">http://datalab.something.org</a></p>
  
  <p>And here is the call</p>
  
  <pre><code>[RemoteRequireHttps]
  public ActionResult Index(string returnUrl, string error)
  </code></pre>
  
  <p>What am i missing here?</p>
  
  <p><strong>Update 1:</strong> My admin has confirmed that the SSL termination has been setup at the lad balancer evel. I have looked at the iis site setup and i don't see https bindings. I only see http binding. Does he need to setup https bindings as well? </p>
  
  <p><strong>Update 2:</strong> @AlexeiLevenkov pointed me to the right direction and <a href="https://gist.github.com/runesoerensen/915869" rel="nofollow">this post</a> had the code that I utilized and it is working. MOVED the code into a separate answer. </p>