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

Adding basepath to the config #6963

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open

Adding basepath to the config #6963

wants to merge 4 commits into from

Conversation

ewassef
Copy link

@ewassef ewassef commented Dec 18, 2024

This will allow the aspire app to handle running behind a reverse proxy such as a k8s ingress on a subpath #4159
#4528
#5134

Description

Added a new dashboard base path option, integrated it into the Dashboard Option, validated and replaced all areas that are creating the links

Fixes # (issue)

Checklist

  • Is this feature complete?
    • Yes. Ready to ship.
    • No. Follow-up changes expected.
  • Are you including unit tests for the changes and scenario tests if relevant?
    • Yes
    • [x ] No
  • Did you add public API?
    • Yes
      • If yes, did you have an API Review for it?
        • Yes
        • No
      • Did you add <remarks /> and <code /> elements on your triple slash comments?
        • Yes
        • [] No
    • No
  • Does the change make any security assumptions or guarantees?
    • Yes
      • If yes, have you done a threat model and had a security review?
        • Yes
        • No
    • No
  • Does the change require an update in our Aspire docs?
Microsoft Reviewers: Open in CodeFlow

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
@dotnet-policy-service dotnet-policy-service bot added the community-contribution Indicates that the PR has been added by a community member label Dec 18, 2024
Copy link
Member

@adamint adamint left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add test coverage in ValidateDashboardOptions.

url = QueryHelpers.AddQueryString(url, "language", language);
url = QueryHelpers.AddQueryString(url, "redirectUrl", redirectUrl);

return url;
}

internal static void SetBasePath(string pathBase) => BasePath = pathBase;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't seem like an optimal way to update BasePath to me. If DashboardUrls is going to store this state, it should be turned into a service and injected.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am following the SetLanguageUrl method above

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It’s different, as SetLanguageUrl does not set state. It only returns the url for the set language url path.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. Is this something that will block the feature from being accepted?

@adamint
Copy link
Member

adamint commented Dec 19, 2024

@JamesNK for review

@ewassef
Copy link
Author

ewassef commented Dec 23, 2024

Please add test coverage in ValidateDashboardOptions.

Tests added

rerunning the PR checks
@davidfowl
Copy link
Member

The options changes look fine, but this is a one liner in middleware https://learn.microsoft.com/en-us/dotnet/api/microsoft.aspnetcore.builder.usepathbaseextensions.usepathbase?view=aspnetcore-9.0.

You can undo all of the other changes you made.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
community-contribution Indicates that the PR has been added by a community member
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants