diff --git a/BTCPayServer/Services/BTCPayServerEnvironment.cs b/BTCPayServer/Services/BTCPayServerEnvironment.cs index a8e5d1105..bdcb187d9 100644 --- a/BTCPayServer/Services/BTCPayServerEnvironment.cs +++ b/BTCPayServer/Services/BTCPayServerEnvironment.cs @@ -7,13 +7,17 @@ using System.Threading.Tasks; using System.Text; using NBXplorer; using NBitcoin; +using Microsoft.AspNetCore.Http; namespace BTCPayServer.Services { public class BTCPayServerEnvironment { - public BTCPayServerEnvironment(IHostingEnvironment env, BTCPayNetworkProvider provider) + public BTCPayServerEnvironment(IHostingEnvironment env, BTCPayNetworkProvider provider, IHttpContextAccessor httpContext) { + ExpectedHost = httpContext.HttpContext.Request.Host.Value; + ExpectedDomain = httpContext.HttpContext.Request.Host.Host; + ExpectedProtocol = httpContext.HttpContext.Request.Scheme; Version = typeof(BTCPayServerEnvironment).GetTypeInfo().Assembly.GetCustomAttribute().Version; #if DEBUG Build = "Debug"; @@ -27,6 +31,11 @@ namespace BTCPayServer.Services { get; set; } + + public string ExpectedDomain { get; set; } + public string ExpectedHost { get; set; } + public string ExpectedProtocol { get; set; } + public NetworkType NetworkType { get; set; } public string Version { diff --git a/BTCPayServer/Views/Shared/_Layout.cshtml b/BTCPayServer/Views/Shared/_Layout.cshtml index 2af9e84cd..98d4d44bf 100644 --- a/BTCPayServer/Views/Shared/_Layout.cshtml +++ b/BTCPayServer/Views/Shared/_Layout.cshtml @@ -78,9 +78,19 @@ + + @RenderBody()