Facebook login fail elb of aws

217 Views Asked by At

There is the same topic at Facebook authentication callback to wrong server with AWS ELB elastic load balancer

It was working perfectly when there was a single instance but after add new instance the FB login not working.

I have enabled the sticky session after that it is not working. I am not using the distributed cache. The main problem is the cookie get changed after redirect from facebook. But do not know what need to do keep the cookie same.

Here is the sticky session setup image that I configure.

enter image description here

1

There are 1 best solutions below

0
On BEST ANSWER

I add the bellow code at the UseNopAuthentication.

 application.Use((context, next) =>
        {
            if (context.Request.Headers["x-forwarded-proto"] == "https")
            {
                context.Request.Scheme = "https";
            }
            return next();
        });

I set the UseHttpXForwardedProto to true from appsettings.json but did not work as we remove http to https redirection from application.

A useful link How to Configure HTTP redirect URL for Facebook Login in ASP.NET MVC