Add forwarded headers options

This commit is contained in:
Trojaner 2020-10-08 16:45:17 +03:00
parent 2e89b8cc6e
commit 6c4eb1db4d

View file

@ -11,6 +11,7 @@ using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using IdentityServer4.Services; using IdentityServer4.Services;
using Microsoft.AspNetCore.HttpOverrides;
using SteamOpenIdConnectProvider.Database; using SteamOpenIdConnectProvider.Database;
using SteamOpenIdConnectProvider.Profile; using SteamOpenIdConnectProvider.Profile;
@ -97,6 +98,16 @@ namespace SteamOpenIdConnectProvider
await next(); await next();
}); });
var forwardOptions = new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto,
RequireHeaderSymmetry = false
};
forwardOptions.KnownNetworks.Clear();
forwardOptions.KnownProxies.Clear();
app.UseForwardedHeaders(forwardOptions);
app.UseRouting(); app.UseRouting();
app.UseIdentityServer(); app.UseIdentityServer();
app.UseEndpoints(endpoints => app.UseEndpoints(endpoints =>