Added the ForwardedHeaders middlewear for Reverse Proxy scenarios #865

pull/1510/head
tidusjar 7 years ago
parent 5294205f40
commit 956b4f6697

@ -11,6 +11,7 @@ using Microsoft.AspNetCore.Authentication.JwtBearer;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.HttpOverrides;
using Microsoft.AspNetCore.Identity; using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore; using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.AspNetCore.SpaServices.Webpack; using Microsoft.AspNetCore.SpaServices.Webpack;
@ -194,6 +195,10 @@ namespace Ombi
public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory, public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory,
IMemoryCache cache, IServiceProvider serviceProvider) IMemoryCache cache, IServiceProvider serviceProvider)
{ {
app.UseForwardedHeaders(new ForwardedHeadersOptions
{
ForwardedHeaders = ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto
});
var ctx = serviceProvider.GetService<IOmbiContext>(); var ctx = serviceProvider.GetService<IOmbiContext>();
loggerFactory.AddSerilog(); loggerFactory.AddSerilog();

Loading…
Cancel
Save