Unable to display dashboard behind reverse proxy


I am trying to run UD behind a reverse proxy (Apache) and seems to fail.

The reverse proxy is set to listen to 443 and redirect to another PC on port 2000
It will ProxyPass /dashboard
So the address would be https:///www.mysite.com/dashboard

<VirtualHost *:443>
	ProxyPreserveHost On
	ServerName www.mysite.com
	ProxyPass /dashboard
	ProxyPassReverse /dashboard

The dashboard.ps1 is simple:

Import-Module UniversalDashboard.Community;
Enable-UDLogging -Console -Level Info
Start-UdDashboard -Content {
    New-UdDashboard -Title "Server Performance Dashboard" -Color '#FF050F7F' -Content {

        New-UDCard -Title "Home"  -Content {
        "Welcome, this is my homepage (Steven Spierenburg)"

    } } -Port 2000 -Wait

Running it locally or from a PC that can connect to it, it will work
As you can see, it runs on port 2000

But when running it via a reverse proxy it fails
This is what the console tells me when I try to connect to the dashboard:

Now listening on:
            Application started. Press Ctrl+C to shut down.
            23:21:51 [Info] Microsoft.AspNetCore.Hosting.Internal.WebHost Request starting HTTP/1.1 GET http://www.mysite.com/
            23:21:51 [Info] Microsoft.AspNetCore.Hosting.Internal.WebHost Request finished in 8.2584ms 200 text/html; charset=utf-8

A very quick and short response. When connecting locally the output is much larger/more lines.
But it shows that something is arriving at UD

However, I get a blank page. When I try with Developer tools to investigate I see this:

GET https://www.mysite.com/main.ec3003e4009bbf28a5cb.bundle.js net::ERR_ABORTED 404 (Not Found)

As you can see, no/dashboard is present anymore
When I change the URL to have that like so:

The page/JS loads in the browser (shows the javascript code)

The page that shows blank is having this content:

<!DOCTYPE html>
<base href="[/](https://www.mysite.com/)"/>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>PowerShell Universal Dashboard</title>
height: 100% !important;
white-space: nowrap !important;
text-align: center !important;
display: block !important;
min-height: auto !important;
flex-direction: row !important;
content: "";
display: inline-block;
vertical-align: middle;
width: 0;
/* adjust for white space between pseudo element and next sibling */
margin-right: -.25em;
/* stretch line height */
height: 100vh;
display: inline-block;
vertical-align: middle;
white-space: normal;
<link rel="shortcut icon" href="[favicon.ico](https://www.mysite.com/favicon.ico)"></head>
<div id="app" class="app"/>
<script type="text/javascript" src="[main.ec3003e4009bbf28a5cb.bundle.js](https://www.mysite.com/main.ec3003e4009bbf28a5cb.bundle.js)"></script><script type="text/javascript" src="[vendor.ec3003e4009bbf28a5cb.bundle.js](https://www.mysite.com/vendor.ec3003e4009bbf28a5cb.bundle.js)"></script></body>

Does anyone know what could be wrong here?

Does anyone have a suggestion on how I could proceed on this? As it stands the dashboard is only reachable on local networks and therefore limited in how I can use it.

Maybe I need to host this in IIS?

I think you can make this work if you use the nested IIS site configuration for your reverse proxy.

Mainly, I think you need to update index.html base tag to include your relative proxy address (e.g. /dashboard/. See here: https://docs.universaldashboard.io/running-dashboards/iis#creating-nested-iis-sites

That said, you will have issues with navigation due to a regression in 2.6.2 (or sometime before that) but you can pull the nightly build to verify that it’s working.

See: https://github.com/ironmansoftware/universal-dashboard/blob/master/tools/install-nightly.ps1

Hi Adam

Thanks for the reply.

Is it fair to say then that if you want to run UD behind a reverse proxy you would need to run UD inside IIS?

I always run UD by starting a PS shell end start the dashboard code/script, listening to a port and access it from then on.

Or is there a way to have UD not only listen to a port but have a base href when starting UD within a PS shell?

I’ve run UD behind nginx as a proxy. I wrote about it.

Hi Nate,

Thanks for that! Very interesting and nice writeup. Awesome.

We are running Apache as reverse proxy and the UD is running on another server, so a bit different but perhaps I can learn from your setup and apply.

And if need be, I can mimic your solution completely, I just need to justify running a small extra server with Ubuntu. I might get away with that

Really appreciate the help Nate, thanks again!

Met vriendelijke groet / Warm regards,

Steven Spierenburg

E steven@jikade.com

M +31 (0) 6 303 38 087