Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add PathBaseMiddleware to Aspire Dashboard #4528

Open
mu88 opened this issue Jun 15, 2024 · 7 comments
Open

Add PathBaseMiddleware to Aspire Dashboard #4528

mu88 opened this issue Jun 15, 2024 · 7 comments

Comments

@mu88
Copy link
Contributor

mu88 commented Jun 15, 2024

Hi 👋🏻

Disclaimer: Since my issue is more a feature request than an API change, I decided not to use one of the predefined templates, but I'm happy to provide any further information you need.

I'm running the Aspire Dashboard as a standalone app via Docker which works nicely 👌🏻 Since multiple Dockerized .NET apps are running on my host, I separated them by making use of the PathBaseMiddleware. This way, I can easily reroute them like this:

var builder = WebApplication.CreateBuilder(args);
var app = builder.Build();
app.UsePathBase("/myapp");

Applying this pattern to the Aspire Dashboard would probably mean adding the following code to DashboardWebApplication.cs:

if (!string.IsNullOrEmpty(builder.Configuration[DashboardConfigNames.PathBase]))
{
    app.UsePathBase(builder.Configuration[DashboardConfigNames.PathBase]); // maybe sanitize PathBase here
}

This way, I could easily reroute the Aspire Dashboard and make it accessible on https://myhost/aspire-dashboard instead of using a dedicated port (e.g. https://myhost:18888/). A corresponding docker-compose.yml could look like this:

services:
  aspire-dashboard:
    image: mcr.microsoft.com/dotnet/aspire-dashboard
    container_name: aspire-dashboard
    ports:
      - 4317:18889
      - 18888:18888
    environment:
      - Dashboard__PathBase=/aspire-dashboard

However, I didn't do a comprehensive and all-encompassing review of the implications and whether this might break certain features - but at least I want to trigger a discussion 🙂

@mitchdenny
Copy link
Member

Do you have a reverse proxy in front?

@mu88
Copy link
Contributor Author

mu88 commented Jun 19, 2024

yes, nginx

@mitchdenny
Copy link
Member

OK thanks for the additional context. @kvenkatrajan not sure where this sits for you in terms of prioritization. It's the first request I've seen for this.

@mitchdenny mitchdenny added this to the Backlog milestone Jun 19, 2024
@kvenkatrajan
Copy link
Member

Thanks @mu88 ..Interesting proposal.

@WardenGnaw / @tmeschter any impact to how this gets launched in codespaces?

CC: @karolz-ms , @drewnoakes

@kvenkatrajan kvenkatrajan added the help wanted Issue that is a good candidate for community contribution. label Jun 24, 2024
@fiotti
Copy link

fiotti commented Aug 1, 2024

Duplicate of #4159

@martin-gft
Copy link

Upvoting this as well!

@davidfowl davidfowl added enhancement and removed help wanted Issue that is a good candidate for community contribution. labels Sep 16, 2024
ewassef added a commit to ewassef/aspire that referenced this issue Dec 18, 2024
This will allow the aspire app to handle running behind a reverse proxy such as a k8s ingress on a subpath
dotnet#4159
dotnet#4528
dotnet#5134
@ewassef
Copy link

ewassef commented Dec 18, 2024

I created a PR for this #6963

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants