1
0
Fork 0
mirror of https://github.com/lidarr/Lidarr synced 2024-12-25 09:12:17 +00:00

Fixed: Bad login redirect using a reverse proxy

(cherry picked from commit b0f04bb9d79a9f9f0021d179ea7273998be7cab3)
(cherry picked from commit ee81ad2add4819920e17ab8b64165a8131ae8dd0)
This commit is contained in:
ta264 2021-06-10 21:59:11 +01:00
parent 3ac2401304
commit be53503ec0

View file

@ -9,6 +9,7 @@
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging; using Microsoft.Extensions.Logging;
@ -47,6 +48,13 @@ public void ConfigureServices(IServiceCollection services)
b.AddNLog(); 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.AddRouting(options => options.LowercaseUrls = true);
services.AddResponseCompression(); services.AddResponseCompression();
@ -143,6 +151,7 @@ public void Configure(IApplicationBuilder app,
firewallAdapter.MakeAccessible(); firewallAdapter.MakeAccessible();
} }
app.UseForwardedHeaders();
app.UseMiddleware<LoggingMiddleware>(); app.UseMiddleware<LoggingMiddleware>();
app.UsePathBase(new PathString(configFileProvider.UrlBase)); app.UsePathBase(new PathString(configFileProvider.UrlBase));
app.UseExceptionHandler(new ExceptionHandlerOptions app.UseExceptionHandler(new ExceptionHandlerOptions