title: HTTP Error 310 ERR_TOO_MANY_REDIRECTS with RequireHttpsAttribute ASP.NET Core
body: <p>I'm building an application on ASP.NET core using MVC. I'm also using the Identity and Entity 7 framework in my application.
  I'm running the application on Microsoft Azure which should come with a HTTPS certificate. </p>
  
  <p>I'm enabling HTTPS in my Startup.cs using this code</p>
  
  <pre><code>services.AddMvc(options =&gt;
          {
              #if !DEBUG
              options.Filters.Add(new RequireHttpsAttribute());
              #endif
          });
  </code></pre>
  
  <p>My problem is that when I visit the web app I get a 310 HTTP ERR_TOO_MANY_REDIRECTS response. I already tried to clear my cookies and re-publish the web app to Azure but none of these work out.</p>
  
  <p>When I disable the above code my application works on Azure. When I then manually type https:// in the browser I get a secure HTTPS connection.</p>