Browse Source

Runtime changes

master
Gregory Rudolph 3 years ago
parent
commit
3dc826f5f5
Signed by: rudi
GPG Key ID: EF64F3CBD1A1EBDD
  1. 2
      Pages/Index.cshtml.cs
  2. 10
      Startup.cs

2
Pages/Index.cshtml.cs

@ -8,7 +8,7 @@ namespace NightmareCoreWeb2.Pages @@ -8,7 +8,7 @@ namespace NightmareCoreWeb2.Pages
{
public class IndexModel : PageModel
{
string connStr = $"server={Program.MysqlServer};user={Program.MysqlUser};database={Program.MysqlDatabase};port={Program.MysqlPort};password={Program.MysqlPassword}";
string connStr = $"SslMode=None;server={Program.MysqlServer};user={Program.MysqlUser};database={Program.MysqlDatabase};port={Program.MysqlPort};password={Program.MysqlPassword}";
public List<Character> OnlineCharacters = new List<Character>();
public Dictionary<string, string> Realms = new Dictionary<string, string>();

10
Startup.cs

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

Loading…
Cancel
Save