From 1a7c641253e1eb5e42c45fc5a930fd0d78e08a66 Mon Sep 17 00:00:00 2001 From: Gregory Rudolph Date: Mon, 9 Aug 2021 20:42:03 -0400 Subject: [PATCH] Use headers --- Startup.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Startup.cs b/Startup.cs index 1efe698..dde9cd5 100644 --- a/Startup.cs +++ b/Startup.cs @@ -24,6 +24,11 @@ namespace NikolaNet public void ConfigureServices(IServiceCollection services) { services.AddRazorPages(); + services.Configure(options => + { + options.ForwardedHeaders = + ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; + }); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. @@ -32,12 +37,14 @@ namespace NikolaNet if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); + app.UseForwardedHeaders(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); + app.UseForwardedHeaders(); } app.UseHttpsRedirection();