You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Expose network-context endpoint resolution (container-reachable URL) in the polyglot/TypeScript AppHost #18787
Is your feature request related to a problem? Please describe the problem.
In C#, an EndpointReference resolves per the consumer's network context (host → localhost, container → host.docker.internal), and you can force a context via new EndpointReference(owner, endpoint, KnownNetworkIdentifiers.DefaultAspireContainerNetwork). The generated TypeScript binding exposes EndpointReference with only .property(EndpointProperty) / .url / .host, which resolve in the consumer's context — there's no way to construct a context-scoped reference or otherwise request the container-reachable form.
So when a host-process resource needs the container-reachable form of its own endpoint in its own env — e.g. a callback base URL that a container calls back into and validates against an allowlist (both sides must be the identical literal) — the TypeScript AppHost can't express it. We hardcode http://host.docker.internal:${port} on both the host app's env and the container's allowlist, plus --add-host=host.docker.internal:host-gateway for Linux.
The per-context behavior is verified by tests/Aspire.Hosting.Tests/EndpointReferenceTests.cs ([Url, Container→Host] → host.docker.internal vs [Url, Host→Host] → localhost).
Describe the solution you'd like
Project a network-context selector to the polyglot surface — e.g. endpoint.inNetwork("container" | "host"), or expose the contextNetworkId constructor parameter / KnownNetworkIdentifiers — so guest AppHosts can obtain a container-reachable endpoint URL without hardcoding host.docker.internal.
Additional context
Aspire CLI 13.4.6, TypeScript AppHost, container tunnel default-on (13.3+). Adjacent: #16641, #11401. Sibling polyglot-surface gap: #18786. Would likely ride the polyglot projection work in #16110.
Activity