|
|
|
@ -2,9 +2,11 @@ using System;
@@ -2,9 +2,11 @@ using System;
|
|
|
|
|
using System.Collections.Generic; |
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Threading.Tasks; |
|
|
|
|
using System.Net; |
|
|
|
|
using Microsoft.AspNetCore.Builder; |
|
|
|
|
using Microsoft.AspNetCore.Hosting; |
|
|
|
|
using Microsoft.AspNetCore.HttpsPolicy; |
|
|
|
|
using Microsoft.AspNetCore.HttpOverrides; |
|
|
|
|
using Microsoft.Extensions.Configuration; |
|
|
|
|
using Microsoft.Extensions.DependencyInjection; |
|
|
|
|
using Microsoft.Extensions.Hosting; |
|
|
|
@ -24,6 +26,12 @@ namespace NightmareCoreWeb2
@@ -24,6 +26,12 @@ namespace NightmareCoreWeb2
|
|
|
|
|
public void ConfigureServices(IServiceCollection services) |
|
|
|
|
{ |
|
|
|
|
services.AddRazorPages(); |
|
|
|
|
services.Configure<ForwardedHeadersOptions>(options => |
|
|
|
|
{ |
|
|
|
|
options.KnownProxies.Add(IPAddress.Parse("192.168.1.102")); |
|
|
|
|
options.ForwardedHeaders = |
|
|
|
|
ForwardedHeaders.XForwardedFor | ForwardedHeaders.XForwardedProto; |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
|
|
|
|
@ -32,10 +40,12 @@ namespace NightmareCoreWeb2
@@ -32,10 +40,12 @@ namespace NightmareCoreWeb2
|
|
|
|
|
if (env.IsDevelopment()) |
|
|
|
|
{ |
|
|
|
|
app.UseDeveloperExceptionPage(); |
|
|
|
|
app.UseForwardedHeaders(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
app.UseExceptionHandler("/Error"); |
|
|
|
|
app.UseForwardedHeaders(); |
|
|
|
|
// The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
|
|
|
|
|
app.UseHsts(); |
|
|
|
|
} |
|
|
|
|