diff --git a/BTCPayServer/Configuration/BTCPayServerOptions.cs b/BTCPayServer/Configuration/BTCPayServerOptions.cs index 3e15e875e..804e77fa5 100644 --- a/BTCPayServer/Configuration/BTCPayServerOptions.cs +++ b/BTCPayServer/Configuration/BTCPayServerOptions.cs @@ -119,5 +119,14 @@ namespace BTCPayServer.Configuration get; set; } + + internal string GetRootUri() + { + if (ExternalUrl == null) + return null; + UriBuilder builder = new UriBuilder(ExternalUrl); + builder.Path = RootPath; + return builder.ToString(); + } } } diff --git a/BTCPayServer/Hosting/Startup.cs b/BTCPayServer/Hosting/Startup.cs index 8d5627680..f983f7603 100644 --- a/BTCPayServer/Hosting/Startup.cs +++ b/BTCPayServer/Hosting/Startup.cs @@ -130,18 +130,18 @@ namespace BTCPayServer.Hosting Logs.Configuration.LogInformation($"Root Path: {options.RootPath}"); if (options.RootPath.Equals("/", StringComparison.OrdinalIgnoreCase)) { - ConfigureCore(app, env, prov, loggerFactory); + ConfigureCore(app, env, prov, loggerFactory, options); } else { app.Map(options.RootPath, appChild => { - ConfigureCore(appChild, env, prov, loggerFactory); + ConfigureCore(appChild, env, prov, loggerFactory, options); }); } } - private static void ConfigureCore(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider prov, ILoggerFactory loggerFactory) + private static void ConfigureCore(IApplicationBuilder app, IHostingEnvironment env, IServiceProvider prov, ILoggerFactory loggerFactory, BTCPayServerOptions options) { if (env.IsDevelopment()) { @@ -156,7 +156,11 @@ namespace BTCPayServer.Hosting app.UseStaticFiles(); app.UseAuthentication(); app.UseHangfireServer(); - app.UseHangfireDashboard("/hangfire", new DashboardOptions() { Authorization = new[] { new NeedRole(Roles.ServerAdmin) } }); + app.UseHangfireDashboard("/hangfire", new DashboardOptions() + { + AppPath = options.GetRootUri(), + Authorization = new[] { new NeedRole(Roles.ServerAdmin) } + }); app.UseWebSockets(); app.UseMvc(routes => {