IIS and pages/navigation

I have setup IIS with UD and seems to work with a simple dashboard but when I try to add pages, it fails to display pages.

Under Default Web Site I have an application called ‘dashboard’.
In ‘index.html’ I have set the base ref to ‘/dashboard/’

If I add this simple dashboard with page:

Start-UdDashboard -Content {
    New-UdDashboard -Title "Hello World" -Color '#FF050F7F' -Content {
        New-UDCard -Title "Home"  -Content {
           "Welcome, this is my homepage!"
        }
    }
} -Wait

The pages shows and the URL in the browser shows:
http://www.mydomain.com/dashboard

But when I try this to add a page and run a dashboard like so:

$Pages = @()
$p = New-UDPage -Name "home" -Title "This is my homepage" -Endpoint { 
    New-UDCard -Title "Home"  -Content {
        "Welcome, this is my homepage!"
    }
} -DefaultHomePage
$Pages += $p
$Dashboard = New-UDDashboard -Title "Hello World" -Pages $Pages
Start-UDDashboard -Dashboard $Dashboard -Wait

I get no content (grey page) and the URL is changed to:
http://www.mydomain.com/home
(notice how ‘dashboard’ is gone from the URL)

If I add the page with the ‘dashboard’ in the name like so:

$p = New-UDPage -Name "dashboard/home" -Title "This is my homepage" -Endpoint {
(notice the ‘dashboard/’ I have added to the -Name parameter)

The the Header and Footer of the site are shown but I get a message in the middle “Page Not Found
The URL does stay as I hope it would stay, so that seems OK:
http://www.mydomain.com/dashboard/home

My guess the “Page Not Found” is because UD is perhaps not liking met to add ‘dashboard/’ to the name but if I don;t then the URL is going to be messed up and not proper for navigation at all.

So my question is : how do the other add pages to the dashboard with content and keeping the URL intact?

I am running this nightly by the way:
https://github.com/ironmansoftware/universal-dashboard/releases/tag/nightly.20191008.12

Dynamic Pages (pages using -endpoint instead of -content) dont take a -name parameter, they need a -url instead.

https://docs.universaldashboard.io/components/pages#dynamic-pages

1 Like

Thanks for the response

Odd, I had the dasboard running with multiple dynamic pages and it all worked. BUt when running in IIS that stopped working and I need to use -Uri instead of -Name. I tried it and from that moment on I cannot get anything to show anymore.

Whatever I do, I now only get the unfolding gif/animation.

This is getting to be very frustrating. I will admit it is most probably my stupidity or lack of knowledge but even the most simple things I cannot get UD to work. I have spent so much time on this now that it becomes a bit concern: should I drop UD and find something else? I love the potential simplicity and the idea that I can work in/with powershell to create these dashboards but man, am I fighting and fighting.

I need to re-group and re-think my strategy here as I cannot keep spending so much time on this, it pains me to say.

Anyway, I will think and see what I can come up with or what to do. Thanks for your support and help, very much appreciated!

Yo @Steven please man don’t give up. I appreciate things can be frustrating, but once things click into place UD is seriously the best product at there for building bespoke software/dashboards using powershell. I used to use Sapien Powershell Studio, but since becoming a dashboarder I have not used it once, and actually converting basically all my Sapien executables to dashboards now…So you hosting this dashboard on WWW on internally at your company? Sometimes you need to stop and start the website in IIS, and fully clear all the cache in the browser to prevent the constant spinner loading screen.

Hi Adam,

Thanks for the uplifting words of encouragement!
And I agree with UD seems to fit a specific bill/niche which I fall into. Plus it uses my favorite language/scripting tool so what is not to like? Hence my struggles and endurance.

But it seemed to have paid off! I finally got the ball rolling. There is but one detail I find odd but can livew ith, other then that I can now finally run dashboards behind a reverse proxy in either a PS shell or IIS. Did not yet try to run as a service but that I can try later on.

So here is the deal. I run servers in AWS which are behind a reverse proxy (and if need be behind a load balancer but let’s skip that for now).
I can pick several servers to run UD on and each set of servers has a domain/hostname.
Let me try to sketch a typical route from client call to server:

Client -> Company DNS -> Reverse Proxy -> SSO (SafeNet) -> AWS Server

So my challenge was to use one hostname (www.systemteam.blabla.morebla.company.com) and run an UD behind that. So this would mean “https://www.systemteam.blabla.morebla.company.com/dashboard
Looks ok and sounds reasonable to me. On the reverse proxy we catch the “www.systemteam.blabla.morebla.company.com” and normally send that to a website on a AWS server. But for the path “/dashboard” I needed to tell the rev proxy to send that request to another server in our cloud. This was a challenge but in hindsight easy. Here it is:

# Redirect UD Dashboard to the UD server
ProxyPass /dashboard http://1.2.3.4:2000
ProxyPassReverse /dashboard http://1.2.3.4:2000

The reverse proxy takes care of SSL and SSO/SafeNet so once you hit those lines, you will have been authenticated and the SSL can be dropped between proxy and UD server (passing onto http as you can see).

I always thought that in order to have the BaseRef set in “<udmodule>\client\index.html” you must host via IIS, this is what all documentation and references from other seem to suggest. Could be me not reading this well but I wanted to mention that this is not needed, you can set that BaseRef and it will affect/apply to you UD hosted in aPS shell as well.
I had to set it to:
<base href="/dashboard/">

Furthermore, I had to either use the “-Name” or “-Url” parameters in the New-UDPage command with the BaseRef included there as well. Something like this:
New-UDPage -Url “/dashboard/home” -Title “This is my homepage” -Endpoint {

New-UDPage -Url "/dashboard/home" -Title "This is my homepage" -Endpoint { 
    New-UDCard -Title "Home"  -Content {
        "Welcome, this is my homepage"
    }
}

There are some minor details but overall this is what I needed to do and set to get it all working.

And like I said, there is 1 thing which I do not understand but perhaps the people here do and can help with.

If I browse to “https://www.systemteam.blabla.morebla.company.com/dashboard” I get directed to “https://www.systemteam.blabla.morebla.company.com/dashboard/home” as expected but the page/part that should have shown the message “Welcome, this is my homepage” shows “Page Not Found”. However, when I start clicking menu items and whatnot, the URL changes to “https://www.systemteam.blabla.morebla.company.com/dashboard/dashboard/home” or “https://www.systemteam.blabla.morebla.company.com/dashboard/dashboard/servers” and so on, and it all works from there on. So I have a double “dashboard” reference in the URL.
Undoubtedly the consequence of me fooling around with all BaseHref and the likes but if possible, I would like to get rid of that.

FYI: I am running a nightly build to make IE work and get rid of the “Page Not Found” error. Not sure if the “Page Not Found” issue I face is related to that though.

But, overall I have it working and I am thrilled to have passed the hurdle!
Thanks to Adam and all the people here (and articles I could find by UD users here and there) I was able to figure it out. I hope that my little writeup here might help others with the struggle they might face.

Wow @Steven that is some setup! Sadly I’m running with some older technology where I work. So not had the chance to dabble with some of the things you mentioned.
So on a totally random note I used to watch thundercats when I was a kid. And whenever they needed help it was “thunder…thunder…thundercats go” so now I done the thundercats call hopefully @adam will be able to shed some light on this…

1 Like

Wow! Nice debugging! Can you write up an issue about the one last issue you are facing? I think the problem here is that the React routing is getting a bit confused by the BaseRef for some reason and I can look into that.

Maybe we need a new document on the docs site to call out this configuration details for a reverse proxy in addition to the IIS configuration details.

1 Like

Thanks guys and yep, it was quite the journey! :grinning:

I created an issue on Github:

2 Likes

I dont know IIS much, I am using it first time to host my UD on company domain. Out of curiosity why you had to set base ref to /dashboard/ in index.html because of application “Dashboard” under default web site?

I have similar setup i.e. DNS, proxy server. I am running UD with IIS under Default Web Site (not as application). I am using both static & dynamic pages all seems to work fine and not facing this double path issue. I created a DNS entry corresponding to my Server IP hosting IIS which will allow me to use www.sql-dashboard.intranet.company.com.

My query is just to understand the issue. Thank you.

Hi Abhijit,

As per the recommended setup and documentation, a nested IIS site need to have the base href set.
The reverse proxy catches the domain and on port 80 we have a website. To get to a sub-path on that same domain I have to catch that path and send it to the IIS server.

Ok nested sites. Got it. I have not tried that. If I get time to setup nested site I will check it but will not be soon.

Hi guys, I ran into a similar issue while creating a a dashboard to automate admin work in my department. I changed my homepage to static and still get the “not found page”. See code below if anyone can point out my mistake I’ll be grateful.
New-UDPage -Name “HomePage” -Icon home -Content {

#$Session:Items = $null

$Cache:Style = New-UDCard -Title '.' -content { }

New-UDHtml -Markup '<br><br><br>'

# Top portion of the page - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 

New-UDRow -Columns {

    # Column 1: "Recent used"

    New-UDColumn -SmallSize 4 -Content {

        New-UDGrid -Id "MostUsedScripts" -Title "Most Used Scripts" -Headers @("Id", "Select") -Properties @("Id", "Select") -Endpoint {

            1..5  | ForEach-Object { 

                [PSCustomObject]@{

                    Id = $_ 

                    Select = New-UDSelect -Option {

                        1..5 | ForEach-Object {

                            New-UDSelectOption -Name $_ -Value $_

                        }

                        

                    }

                }

            } | Out-UDGridData

        }

        #New-UDCard -Text 'Most used/recent used or history. Change to a dropdown or table/grid.'           

    }

    # Column 2: "Most used"

    New-UDColumn -SmallSize 4 -Content {

        New-UDGrid -Id "RecentlyUsedScripts" -Title "Recently Used Scripts" -Headers @("Id", "Select") -Properties @("Id", "Select") -Endpoint {

            1..5  | ForEach-Object { 

                [PSCustomObject]@{

                    Id = $_ 

                    Select = New-UDSelect -Option {

                        1..5 | ForEach-Object {

                            New-UDSelectOption -Name $_ -Value $_

                        }

                        

                    }

                }

            } | Out-UDGridData

        }

        #New-UDCard -Text 'Most used/recent used or history. Change to a dropdown or table/grid'         

    }

    # Column 3: Search Bar

    New-UDColumn -SmallSize 4 -Content {

        New-UDCard -Id 'Debug' -Text 'Search All' -TextAlignment "center" 

        New-DudSearch -Id 'aac' -OnEnter { Set-UDElement -id 'Debug' -content { "OnEnter event: Enter key was pressed" } } -OnChange {

            Set-UDElement -id 'Debug' -content { "Searching: $EventData" }            

            if ($Cache:Items -ne $null ) {

                if ($Session:Items -eq $Null) {

                    $Session:Items = $Cache:Items | ForEach-Object {

                        [PSCustomObject]@{

                            ID      = $_.id

                            Visible = $True

                        }

                    }

                }

                for ($i = 0; $i -lt $array.Count; $i++) { }       

                $MatchItemIds = @($Cache:Items.Where{ $_.text -like "*$EventData*" } | Select-Object -ExpandProperty Id)

                for ($i = 0; $i -lt $Session:Items.count; $i++) {

                    $Item = $Session:Items[$i]

                    if ($MatchItemIds.contains($Item.id)) {

                        if ($Item.Visible -eq $false) {

                            Set-UDElement -Attributes $Cache:Style.Attributes  -Id $Item.id

                            $Item.Visible = $true

                        }

                    }

                    else {

                        if ($Item.Visible -eq $true) {

                            Set-UDElement -Attributes @{style = @{display = 'none' } } -Id $Item.id

                            $Item.Visible = $false

                        }

                    }

                }        

            }

        }

        # Must Do!!! Add each new script here, follow below instructions. (Step1 and Step2)  

        $Items = [System.Collections.Generic.List[PSObject]]::new()

    

        # Step1: Add a link for each new script, example how below.

        

        #Script#1            

        $ScriptLinkCmorRequest = [PSCustomObject]@{

            id   = New-Guid

            text = "CMOR Request script"

        }

        New-UDCard -Title "" -Text $ScriptLinkCmorRequest.text -Id $ScriptLinkCmorRequest.id -Links @(New-UDLink -Text "Click Me" -Id $ScriptLinkCmorRequest.id -Url http://localhost:10000/CmorRequest) 

        

        #Scrpt#2

        $ScriptLinkAdGroupMembershipReport = [PSCustomObject]@{

            id   = New-Guid

            text = "AD Group Membership script"

        }

        New-UDCard -Title "" -Text $ScriptLinkAdGroupMembershipReport.text -Id $ScriptLinkAdGroupMembershipReport.id -Links @(New-UDLink -Text "Click Me" -Id $ScriptLinkAdGroupMembershipReport.id -Url http://localhost:10000/ADGroupMembershipReport)

        

        #Script#3

        $ScriptLinkFilterSsnVisa = [PSCustomObject]@{

            id   = New-Guid

            text = "Filter SSN and Visa"

        }

        New-UDCard -Title "" -Text $ScriptLinkFilterSsnVisa.text -Id $ScriptLinkFilterSsnVisa.id -Links @(New-UDLink -Text "Click Me" -Id $ScriptLinkFilterSsnVisa.id -Url http://localhost:10000/FilterSsnVisa)            

        

        #Script(test)

        $ScriptLinkPasswordReset = [PSCustomObject]@{

            id   = New-Guid

            text = "Password Reset"

        }

        New-UDCard -Title "" -Text $ScriptLinkPasswordReset.text -Id $ScriptLinkPasswordReset.id -Links @(New-UDLink -Text "Click Me" -Id $ScriptLinkPasswordReset.id -Url http://localhost:10000/PasswordReset)



        # Step2: Add each new script links to the $Items list, otherwise search won't see them.

        

        $Items.Add($ScriptLinkPasswordReset)

        $Items.Add($ScriptLinkFilterSsnVisa)

        $Items.Add($ScriptLinkCmorRequest)

        $Items.Add($ScriptLinkAdGroupMembershipReport)

        $Cache:Items = $Items 

    }  

} # END - Top portion of the page. = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =   

} -AuthorizationPolicy “Admins”

To elaborate on the issue, I had
New-UDPage -Name -Endpoint (which from reading here is wrong but it worked while developing).
Once I added to IIS then I got the “page not found”. I went back to my dev server (not IIS) and changed to
New-UDPage -Name -Content and the change it worked in dev but not in IIS. :frowning: