Fixed: Bad login redirect using a reverse proxy

(cherry picked from commit b0f04bb9d79a9f9f0021d179ea7273998be7cab3)
(cherry picked from commit ee81ad2add4819920e17ab8b64165a8131ae8dd0)
pull/6682/head
ta264 3 years ago
parent 147cfe538a
commit 4b06f6b506

@ -3,6 +3,7 @@ using System.Collections.Generic;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
@ -48,6 +49,13 @@ namespace NzbDrone.Host
b.AddNLog();
});
services.Configure<ForwardedHeadersOptions>(options =>
{
options.ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto;
options.KnownNetworks.Clear();
options.KnownProxies.Clear();
});
services.AddRouting(options => options.LowercaseUrls = true);
services.AddResponseCompression();
@ -144,6 +152,7 @@ namespace NzbDrone.Host
firewallAdapter.MakeAccessible();
}
app.UseForwardedHeaders();
app.UseMiddleware<LoggingMiddleware>();
app.UsePathBase(new PathString(configFileProvider.UrlBase));
app.UseExceptionHandler(new ExceptionHandlerOptions

Loading…
Cancel
Save