Hangfire Dashboard issue with Dot NET Core hosted on Linux with Nginx

We are developing a web app using Dot NET Core. In this app, we have some long running processes for that we have decided to go with Hangfire. We are able to integrate Hangfire successfully and view the Hangfire Dashboard, and other pages like Retires, Jobs etc locally. But when we deploy the code, we can see the dashboard, but all the CSS and JS and Links are pointing to domain/hangfire/ instead of domain/appname/hangfire.

Our server is running on Linux and we are using Nginx to host web apps.

I assume that in Linux we are creating our Virtual Directory or appname dynamically, hangfire is not able to pick this. If we deploy this on a windows machine it is working fine.

Please see below the code we are using to setup hangfire.

public void ConfigureServices(IServiceCollection services)
{
        services.AddHangfire(x => x.UseMemoryStorage());
}

public void Configure(IApplicationBuilder app, IHostingEnvironment env, ILoggerFactory loggerFactory)
{
         app.UseHangfireServer();
        app.UseHangfireDashboard("/hangfire");
}

This issue is not blocking us, but it will be very handy if we could able to see the dashboard.

Any help will be appreciated.

Manage to solve it by adding this to Startup.cs Configure it must be the first line, before anything else.

app.Use((context, next) =>
 {
      context.Request.PathBase = Configuration["AppSettings:YourInternalBasePath"];
      return next();
 });

Hope it helps.