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

Handle parsing wildcard urls in launch profiles #5588

Merged
merged 7 commits into from
Sep 9, 2024
Merged

Conversation

davidfowl
Copy link
Member

@davidfowl davidfowl commented Sep 8, 2024

Description

  • As part of this change expose TargetHostAddress on EndpointAnnotation which describes the original address that was bound to in both the kestrel endpoint list and the launch profile's application urls.
  • Added a test

Fixes #5587

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
    • 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?
    • Yes
      • Link to aspire-docs issue:
    • No
Microsoft Reviewers: Open in CodeFlow

- As part of this change expose TargetHostAddress on EndpointAnnotation which describes the original address that was bound to in both the kestrel endpoint list and the launch profile's application urls.
- Added a test

Fixes #5587
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication label Sep 8, 2024
@davidfowl
Copy link
Member Author

cc @davidebbo

@mitchdenny
Copy link
Member

What impact does this have around requests that are proxied via DCP? I would have thought that for this to be useful the proxy would need to pass through a host header?

@davidfowl
Copy link
Member Author

davidfowl commented Sep 8, 2024

What impact does this have around requests that are proxied via DCP? I would have thought that for this to be useful the proxy would need to pass through a host header?

For proxied URLs, I think we could make this useful for DCP by setting the binding address (I think that is supported) to 0.0.0.0 if the input is *. I didn't want to tackle that in this PR though as there are potentially security implications. That said, the behavior now not be what is expected if the url is proxied.

We'll end up with the app binding on all interfaces but the dcp proxy using that port and binding to localhost. It will work but may not have the desired effect.

PS: This is what happens today with kestrel endpoints defined as *. We ignore this for DCP's binding and use localhost.

- We still treat this allocated endpoint as being accessible via localhost only in the ux
@davidfowl
Copy link
Member Author

OK I made a change to tell the dcp service about the address.

@davidfowl davidfowl requested a review from karolz-ms September 8, 2024 22:00
@davidfowl
Copy link
Member Author

/azp run

Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@davidfowl davidfowl merged commit 15a23b5 into main Sep 9, 2024
11 checks passed
@davidfowl davidfowl deleted the davidfowl/parse-url branch September 9, 2024 18:19
@davidfowl davidfowl added this to the 9.0 milestone Oct 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-app-model Issues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplication
Projects
None yet
Development

Successfully merging this pull request may close these issues.

AppHost project crashes on startup: System.UriFormatException: Invalid URI: The hostname could not be parsed.
4 participants