aspire
aspire copied to clipboard
Hosting Dashboard from child path (https://domain/my/child/path) does not appear to work correctly
I am trying to host the aspire dashboard from k8s running on AKS using nginx as an ingress controller and running into some issues. I would essentially like to host the dashboard from:
https://mydomainhere/dev/aspire/dashboard
Using aspirate to generate some basic config I have managed to successfully deploy the dashboard out via helm and can access it from the above URL - it however immediately redirects to https://mydomainhere/structuredlogs
I believe it should be trying to redirect to https://mydomainhere/dev/aspire/dashboard/structuredlogs
I can put that directly into the browser and it then fails due to it trying to load js/css resources from https://mydomainhere/
I presume this might be related to it deploying out with a <base href="/">
I tried to see if setting ASPNETCORE_URLS
as mentioned here https://learn.microsoft.com/en-us/dotnet/aspire/fundamentals/dashboard/configuration#common-configuration might help but that just leads to an error on startup:
Hosting failed to start
System.InvalidOperationException: A path base can only be configured using IApplicationBuilder.UsePathBase()
I don't think I can "fix" this issue via ingress config as I have multiple other web apps running so can't just, for example, redirect any traffic to https://mydomainhere/
back out to https://mydomainhere/dev/aspire/dashboard
Is this a scenario that is not currently supported? Any advice would be greatly appreciated, thank you!
it is not only the base href tag, all js sources, rely on hosting direclty on root path (/). Even when i use IIS AAR (Reverse proxy) and replace base path and link strings, it will show a page, but js interactions are not working well. Seems that this project is not prepared for hosting on subpaths. Maybe we get support in future as well. For workaround i will use a separate port for it, directly mapping to aspire. Alternatively you can configure a second port in ingress and redirect it via https to aspire. i know it is annoying but i cant see an easy change.
This is an issue for the Blazor aspect of the Dashboard. If it's being hosted at a deeper url than expected, then the paths for loading other resources such as css or json will be wrong if they use absolute URLs.
IIRC there is not a standard way for the proxy to tell the application that there is a different base URL. What we could do would be to support a custom header in the proxy and use that as the <base href="/">
. If the proxy is then configured to add that header, the dashboard can create absolute URLs that will work correctly.
@adityamandaleeka @benjaminpetit to confirm my memory for proxy related thoughts.
@samsp-msft , For Blazor Server app, in App.razor
, use the following to set the base href, all the static assets should be still accessible:
<head>
<!-- ... -->
<base href="@_systemOptions.Value.DeploymentBaseHref" />
<!-- ... -->
</head>
We probably want a config property (an env var) for the base URI so that can be set in k8s etc for the standalone dashboard, as it will need to be the URI that the client accesses not the URI the dashboard is actually hosted at.