RequireHttps causes redirect loop on Amazon Elastic Load Balancer

后端 未结 3 1884
猫巷女王i
猫巷女王i 2021-01-05 09:31

I have an ASP.NET MVC 4 application running behind Amazon\'s elastic load balancer. Everything works OK when I install my SSL certificate on the load balancer and t

3条回答
  •  悲&欢浪女
    2021-01-05 10:34

    I provided a solution for this in the following link: https://stackoverflow.com/questions/37954796/requirehttpsattribute-with-netcore-rc2-causes-http302-redirect-loop-on-azure#=

    Which says:

    You can work around this by adding the following lines to ConfigureServices in Startup.cs (and add "using Microsoft.AspNetCore.HttpOverrides;")

    services.Configure(options =>
            {
                options.ForwardedHeaders = ForwardedHeaders.XForwardedProto;
            });
    

提交回复
热议问题