Merge pull request #4671 from cvium/allow_proxy

Clear KnownNetworks and KnownProxies if none are configured explicitly
This commit is contained in:
Bond-009 2020-12-05 16:22:11 +01:00 committed by GitHub
commit 804dd00425
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -169,11 +169,19 @@ namespace Jellyfin.Server.Extensions
.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
for (var i = 0; i < knownProxies.Count; i++)
if (knownProxies.Count == 0)
{
if (IPAddress.TryParse(knownProxies[i], out var address))
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
}
else
{
for (var i = 0; i < knownProxies.Count; i++)
{
options.KnownProxies.Add(address);
if (IPAddress.TryParse(knownProxies[i], out var address))
{
options.KnownProxies.Add(address);
}
}
}
})