'"X-Forwarded-For" in request is always null - .Net Core

I'm trying to authenticate the user also using his current IP address, but for some reason it's returning null every single time.

    public class IdentityResolver
        {
            public void Resolve(CustomerRequest request, HttpContext context)
            {
                var ip = context.Request.Headers["X-Forwarded-For"].ToString();
                context.RequestServices.GetService<IAuthenticationService>().Login(request.Cpf, request.Birthdate, ip);
            }
        }

Or is it something my front-end application requires to make it work?

I'm running .NET Core 3.1



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source