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();