Login with load balancer

45 views Asked by At

My application works, after switching to a load balancer server, the claim works sometimes and sometimes not.

This is in .NET Core 6:

.AddCookie(CookieAuthenticationDefaults.AuthenticationScheme, o =>
{
    o.LoginPath = new PathString("/Cadastro");
    o.ExpireTimeSpan = TimeSpan.FromDays(1);
    o.SlidingExpiration = true;
    var defaultCallback = o.Events.OnRedirectToLogin;
    o.Events.OnRedirectToLogin = context =>
    {
        context.RedirectUri = "/Login";
        context.Response.Redirect(context.RedirectUri);

        return defaultCallback(context);
    };
});

I've changed the settings several times, none of which resolved it.

0

There are 0 answers