Cannot access the "public" URL of a resource when using the `dev.localhost` applicationUrls
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 991
- Avg merge
- 2d 15h
- Merged PRs (30d)
- 196
Description
We have a scenario where we have a frontend browser based application which calls a Backend API. The backend API needs to be configured with CORS rules for which frontend clients are able to call this API, which is driven from environment variables. So we need to know what the _public_ URLs are that requests will be coming in from.
When using the `dev.localhost` "vanity" hostname system in Aspire, the actual hostname you will be accessing the frontend via is `resourceName-appname.dev.localhost:XXXX`, however it does not appear that we have a way to get this endpoint from a resource to pass this through.
`resource.GetEndpoint("https", KnownNetworkIdentifiers.LocalhostNetwork);` <- this will return `localhost:XXXX`. There doesn't seem to be a means of getting the `*.dev.localhost:XXXX` hostname that is presented in the Aspire dashboard.
Contributor guide
Research direction
Start with the resource.GetEndpoint("https", KnownNetworkIdentifiers.LocalhostNetwork) entry point and compare its localhost result with the dev.localhost URL shown in the Aspire dashboard. Done means a resource can expose the public vanity hostname and port needed to configure frontend CORS rules.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools, networking
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100