title: Load Balancer "Invalid HTTP request for token endpoint"
body: <p>I have an issue with a IdentityServer behind a load balancer,<br>
  Just to be clear if I'm using direct ips, evertything works as expected.</p>
  
  <p>Currently I have an SSL configuration on LB with a valid certificate that redirects to a HTTP docker-engines hosted on 2 Linux machines.</p>
  
  <p>I'm using an MVC hybrid flow on my Client: </p>
  
  <pre><code>app.UseOpenIdConnectAuthentication(new OpenIdConnectOptions
  {
      AuthenticationScheme = "oidc",
      SignInScheme = "Cookies",
      Authority = settings.Server,
      RequireHttpsMetadata = "false",
      ClientId = "MyMvcClient",
      ClientSecret = "MyMvcSuperPassword",
      ResponseType =  "code id_token",
      GetClaimsFromUserInfoEndpoint = true,
      SaveTokens = true,
      TokenValidationParameters = new TokenValidationParameters
      {
          NameClaimType = JwtClaimTypes.Name,
          RoleClaimType = JwtClaimTypes.Role,
      },
      Events = new OpenIdConnectEvents()
      {
          OnRemoteFailure = context =&gt;
          {
              context.Response.Redirect("/error");
              context.HandleResponse();
              return Task.FromResult(0);
          }
      },
      "Scope": { "openid", "profile", "email", "myclient", "offline_access" }
  });
  </code></pre>
  
  <p>On the server side, I have the following setup:</p>
  
  <pre><code>public void ConfigureServices(IServiceCollection services)
  {
      services.AddDbContext&lt;IdentityDbContext&gt;(builder);
      services.AddIdentity&lt;ApplicationUser, ApplicationRole&gt;()
          .AddEntityFrameworkStores&lt;IdentityDbContext, Guid&gt;()
          .AddUserStore&lt;UserStore&lt;ApplicationUser, ApplicationRole, IdentityDbContext, Guid&gt;&gt;()
          .AddRoleStore&lt;RoleStore&lt;ApplicationRole, IdentityDbContext, Guid&gt;&gt;()
          .AddUserManager&lt;LdapUserManager&gt;()
          .AddSignInManager&lt;LdapSignInManager&gt;()
          .AddDefaultTokenProviders()
          .AddIdentityServerUserClaimsPrincipalFactory();
      ...
      string redisSettings = $"{redisHost}:{redisPort},ssl={redisSsl},abortConnect={redisAbortConnect},password={redisPassword}";
      services.AddDataProtection().PersistKeysToRedis(redis, redisKey);
      ...
      // Adds IdentityServer
      services.AddIdentityServer()
          .AddSigningCredential(new X509Certificate2("IdentityServerAuth.pfx"))
          .AddConfigurationStore(builder)
          .AddOperationalStore(builder)
          .AddAspNetIdentity&lt;ApplicationUser&gt;()
          .AddProfileService&lt;IdentityProfileService&gt;();
  }
  public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, IServiceProvider serviceProvider)
  {
      app.UseIdentity();
      app.UseForwardedHeaders(new ForwardedHeadersOptions
      {
          ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
      });
      // Adds IdentityServer
      app.UseIdentityServer();
  }
  </code></pre>
  
  <p>As I already mentioned, it works for configuration without Load balancer, but client fails with error 
      "Message contains error: 'invalid_request', error_description: 'error_description is null', error_uri: 'error_uri is null'."</p>
  
  <p>And on the server side I'm receiving 
      info: IdentityServer4.Hosting.IdentityServerMiddleware[0]
        Invoking IdentityServer endpoint: IdentityServer4.Endpoints.TokenEndpoint for /connect/token
      warn: IdentityServer4.Endpoints.TokenEndpoint[0]
        Invalid HTTP request for token endpoint</p>