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
Add browser-facing origin references for CORS and redirect configuration - #21260
Browser-facing URLs such as *.dev.localhost, customized public URLs, and Codespaces forwarding URLs can differ from physical endpoint addresses. Expose those origins as deferred endpoint references so CORS and authentication configuration can agree with the address the browser uses, without changing host/container service discovery.
PrimaryBrowserOrigin resolves to one preferred HTTP(S) origin.
BrowserOrigins resolves to a comma-separated list of distinct HTTP(S) origins.
In run mode, both use finalized endpoint URLs after customization and Codespaces projection, in URL display preference order. Origins exclude credentials, paths, queries, and fragments. The physical allocated HTTP(S) origin is retained after customized origins, even when its dashboard link is removed. The primary origin is the first entry in that same sequence, falling back to the allocated origin when no customized origins remain. Without any HTTP(S) origins, both values are empty. Resolution is independent of the reference's service-discovery network context.
Entra endpoint redirect helpers now consume PrimaryBrowserOrigin directly, removing the custom comma splitting from generated Bicep. Local resolution preserves the warned 30-second fallback to the allocated origin if URL finalization does not complete. Publish-mode resolution uses the compute environment's primary-browser-origin expression. The Node Entra playground uses the same scalar reference for its base URL; the playground launch-settings changes are included.
Both properties are also exposed through the generated TypeScript, Go, Java, Python, and Rust SDKs.
Publication
Local display URLs are not deployment addresses. Publishers interpret both properties through their deployed endpoint mappings:
Azure Container Apps and App Service: use public deployed HTTP(S) origins; unsupported internal or non-HTTP(S) references are rejected. Container Apps Express applies its public-endpoint visibility checks to both properties.
Docker Compose: uses independently configurable deployment inputs, defaulting to localhost and the explicit published port for external HTTP(S) endpoints. Unknown published ports require explicit input.
Kubernetes, including AKS-backed publishing: derives defaults from matching literal Ingress/Gateway hostnames and TLS configuration. The scalar default is the first origin from the same matching routes. Hostless, wildcard, or deferred hostname sources require explicit input.
Foundry: uses the authority of the deployed project endpoint.
Azure Sandboxes: resolves the authority of the deployed proxy URL after producer deployment.
Radius: uses required deployment inputs for external HTTP(S) workload endpoints rather than cluster-local DNS. Unsupported recipe-backed endpoints are rejected.
Compose, Kubernetes, and Radius keep scalar and list inputs separate: for example, Parameters:web-http-PrimaryBrowserOrigin contains one origin, while Parameters:web-http-BrowserOrigins contains the list. The scalar input is not obtained by splitting a configured list input.
The manifest publisher lowers both properties to required inputs, including references inside selected conditional branches, formatted expressions, and resource manifest callbacks. Existing supported endpoint tokens remain symbolic for azd.
The endpoint properties are additive, but this PR includes behavioral compatibility changes:
For allocations completed through DCP or PublishResourceEndpointsAllocatedAsync, WithUrls and WithUrlForEndpoint callbacks now finish before ResourceEndpointsAllocatedEvent handlers run. Code registering URL customization inside those handlers must move registration into model configuration. Physical endpoint allocation and host/container service discovery remain unchanged.
Custom endpoint allocators that call eventing.PublishAsync(new ResourceEndpointsAllocatedEvent(resource, services), cancellationToken) directly no longer trigger the orchestrator's URL processing: WithUrls / WithUrlForEndpoint callbacks do not run, generated dashboard URLs are not automatically published, and BrowserOrigins / PrimaryBrowserOrigin references can remain pending indefinitely unless canceled. After assigning the physical endpoints, use eventing.PublishResourceEndpointsAllocatedAsync(new ResourceEndpointsAllocatedEvent(resource, services), cancellationToken) to finalize URLs before notifying subscribers. Direct publication still dispatches the event and does not invalidate physical endpoint values. The existing MAUI synthetic OTLP stubs still use direct publication; browser-origin support for those stubs is not provided by this PR.
Manifest publication rejects unsupported :uri formatting on endpoint bindings and non-parameter connection-string references instead of silently dropping the format. For example, ReferenceExpression.Create($"https://login.example/?redirect_uri={web.GetEndpoint("https"):uri}") still resolves in run mode but fails manifest publication because azd cannot faithfully encode that reference. Use a parameter or infrastructure output for the full value that needs encoding, or configure the encoded value explicitly. Removing the format preserves the symbolic reference but does not encode it.
Security considerations
Origins can feed CORS allowlists and authentication redirect configuration. URL customization remains application-controlled; local vanity URLs are not silently reused as deployment addresses. No new listeners or authorization mechanisms are introduced.
Validation
Latest local validation covers implementation commit 14455757af; current head 317e1b82a9 additionally removes the browser-origin section from the core package README. Snapshot updates were reviewed and the affected tests rerun.
The repository SDK was used to build test projects. Tests were launched with the installed .NET 10 host because the repository-local SDK installation did not contain the required .NET 10 runtime. Quarantined and outerloop tests were excluded.
Entra provisioning class: 133 passed initially; the remaining test reported an expected Bicep snapshot change removing first(split(...)). After reviewing the updated snapshot, its focused rerun passed. The project build succeeded.
Generated SDK snapshots for TypeScript, Go, Java, Python, and Rust, plus the TypeScript browser-reference scanner check: passed, 6 tests in total. Each corresponding project build succeeded. The following invocation was executed for each language project after reviewing regenerated snapshots:
The ACA starter and Foundry hosted-agent deployment scenarios now inject and assert PrimaryBrowserOrigin alongside BrowserOrigins, but live deployment E2E tests were not run for the latest implementation. Earlier smoke/deployment evidence is available in the testing report and deployment run; those results predate the latest changes and do not validate them. The earlier run included a failing Sandbox port-exposure scenario.
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?
Finalize customized browser URLs before endpoint allocation observers, expose deferred origin and URL projections, and use them for Entra redirects. Lower manifest values through existing schema features while preserving selected-path evaluation and symbolic deployment references.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b3d226ee-2c7f-4986-a0e4-a6d27b72f6ec
Eric Erhardt (@eerhardt) I did a thing based on our discussion of how the browser URLs would need to work to be general purpose. This basically takes the work you did but makes it generalized and removes the callback order risk.
Lower complete structured expressions before token matching and reject ambiguous provider matches. Retain formatting alias metadata so nested URI encoding preserves each pass without resolving deployment parameters.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b3d226ee-2c7f-4986-a0e4-a6d27b72f6ec
The new sandbox-origin test pre-populates Ports, so it verifies URI extraction but not that a browser-origin reference is resolved after its producer deploys and reaches the consuming workload. No deployment E2E currently consumes BrowserOrigins. Please extend tests/Aspire.Deployment.EndToEnd.Tests/AzureSandboxesDeploymentTests.cs with a producer/consumer scenario that injects these properties and compares the consumer's received values with the producer's actual deployed proxy authority; this would catch deployment-order and value-projection failures that the seeded-state test cannot detect.
Preserve the Azure environment test imports and upstream experimental API suppression. Update the browser-origin Entra snapshot for the upstream service-principal tags.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b3d226ee-2c7f-4986-a0e4-a6d27b72f6ec
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
Cross-publisher endpoint ordering affects security-sensitive CORS and redirect values, while deployment evidence predates later revisions and includes a Sandbox failure, requiring human confirmation of current-revision behavior.
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The linked deployment run failed Sandbox port exposure and predates later revisions, leaving current cross-publisher origin/authentication handling and allocation-event ordering requiring human runtime verification.
Use a scalar browser-origin reference for Entra redirect URIs and Node base URL configuration. Wire manifest inputs, native publishers, polyglot SDKs, documentation, and regression coverage while preserving the Entra playground launch settings changes.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
The reason will be displayed to describe this comment to others. Learn more.
🟡 Changes recommended
Two Bicep snapshot baselines still expect comma-list projections instead of direct single-origin interpolation, causing the redirect and starter publish snapshot comparisons to fail.
Mark the polyglot redirect fixture endpoint external to match deployment requirements.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b3d226ee-2c7f-4986-a0e4-a6d27b72f6ec
Include the resource identity and location outputs emitted by the updated App Service publisher.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b3d226ee-2c7f-4986-a0e4-a6d27b72f6ec
The reason will be displayed to describe this comment to others. Learn more.
🔵 Needs a closer look
The latest lifecycle-ordering, origin-mapping, and Entra redirect changes lack live deployment validation against current head, particularly for the previously failing Sandbox port-exposure scenario.
The reason will be displayed to describe this comment to others. Learn more.
Re-review at 4c49f2ff89 from reading the code; nothing was compiled or run.
Both of my 11-04 threads are resolved. The 30-second Entra bound falls back to the allocated origin again, and the :uri manifest break is now listed under Compatibility.
The one inline comment is minor and fine as a follow-up.
Still open, and I'd want it settled before merge: the point from my 11-03 review about direct publishers hasn't been answered. ApplicationOrchestrator no longer subscribes to ResourceEndpointsAllocatedEvent, and MauiOtlpExtensions.cs still calls PublishAsync(new ResourceEndpointsAllocatedEvent(...)) at lines 209 and 524. Custom resources outside the repo that use that pattern lose their URLs and WithUrls callbacks, and BrowserOrigins references to their endpoints wait forever. The Compatibility section doesn't mention it. Either a guarded subscription or a Compatibility entry would settle it.
Submitting as a comment rather than an approval, since auto-merge is on and this review carries comments. That also means this comment won't hold the merge.
Check the compute environment's TLS property during infrastructure generation so HTTP endpoints with HTTPS upgrade disabled fail early. Preserve run-mode behavior and explicit TLS overrides, and cover ACA and App Service upgrade settings.
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: b3d226ee-2c7f-4986-a0e4-a6d27b72f6ec
Added a "Browser-facing origins" section to fundamentals/networking-overview.mdx covering PrimaryBrowserOrigin/BrowserOrigins, run/publish behavior, and compatibility notes. Signals: integration_readme_changed (Aspire.Hosting.Docker/Kubernetes/Foundry READMEs), pr_label_breaking_change (breaking-change), pr_body_has_security_marker, pr_body_has_cli_flag_mention (the last two are likely false positives from test commands).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
area-app-modelIssues pertaining to the APIs in Aspire.Hosting, e.g. DistributedApplicationbreaking-changeIssue or PR that represents a breaking API or functional change over a prerelease.
4 participants
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Browser-facing URLs such as
*.dev.localhost, customized public URLs, and Codespaces forwarding URLs can differ from physical endpoint addresses. Expose those origins as deferred endpoint references so CORS and authentication configuration can agree with the address the browser uses, without changing host/container service discovery.PrimaryBrowserOriginresolves to one preferred HTTP(S) origin.BrowserOriginsresolves to a comma-separated list of distinct HTTP(S) origins.In run mode, both use finalized endpoint URLs after customization and Codespaces projection, in URL display preference order. Origins exclude credentials, paths, queries, and fragments. The physical allocated HTTP(S) origin is retained after customized origins, even when its dashboard link is removed. The primary origin is the first entry in that same sequence, falling back to the allocated origin when no customized origins remain. Without any HTTP(S) origins, both values are empty. Resolution is independent of the reference's service-discovery network context.
Entra endpoint redirect helpers now consume
PrimaryBrowserOrigindirectly, removing the custom comma splitting from generated Bicep. Local resolution preserves the warned 30-second fallback to the allocated origin if URL finalization does not complete. Publish-mode resolution uses the compute environment's primary-browser-origin expression. The Node Entra playground uses the same scalar reference for its base URL; the playground launch-settings changes are included.Both properties are also exposed through the generated TypeScript, Go, Java, Python, and Rust SDKs.
Publication
Local display URLs are not deployment addresses. Publishers interpret both properties through their deployed endpoint mappings:
Compose, Kubernetes, and Radius keep scalar and list inputs separate: for example,
Parameters:web-http-PrimaryBrowserOrigincontains one origin, whileParameters:web-http-BrowserOriginscontains the list. The scalar input is not obtained by splitting a configured list input.The manifest publisher lowers both properties to required inputs, including references inside selected conditional branches, formatted expressions, and resource manifest callbacks. Existing supported endpoint tokens remain symbolic for azd.
Fixes #18819
Compatibility
The endpoint properties are additive, but this PR includes behavioral compatibility changes:
PublishResourceEndpointsAllocatedAsync,WithUrlsandWithUrlForEndpointcallbacks now finish beforeResourceEndpointsAllocatedEventhandlers run. Code registering URL customization inside those handlers must move registration into model configuration. Physical endpoint allocation and host/container service discovery remain unchanged.eventing.PublishAsync(new ResourceEndpointsAllocatedEvent(resource, services), cancellationToken)directly no longer trigger the orchestrator's URL processing:WithUrls/WithUrlForEndpointcallbacks do not run, generated dashboard URLs are not automatically published, andBrowserOrigins/PrimaryBrowserOriginreferences can remain pending indefinitely unless canceled. After assigning the physical endpoints, useeventing.PublishResourceEndpointsAllocatedAsync(new ResourceEndpointsAllocatedEvent(resource, services), cancellationToken)to finalize URLs before notifying subscribers. Direct publication still dispatches the event and does not invalidate physical endpoint values. The existing MAUI synthetic OTLP stubs still use direct publication; browser-origin support for those stubs is not provided by this PR.:uriformatting on endpoint bindings and non-parameter connection-string references instead of silently dropping the format. For example,ReferenceExpression.Create($"https://login.example/?redirect_uri={web.GetEndpoint("https"):uri}")still resolves in run mode but fails manifest publication because azd cannot faithfully encode that reference. Use a parameter or infrastructure output for the full value that needs encoding, or configure the encoded value explicitly. Removing the format preserves the symbolic reference but does not encode it.Security considerations
Origins can feed CORS allowlists and authentication redirect configuration. URL customization remains application-controlled; local vanity URLs are not silently reused as deployment addresses. No new listeners or authorization mechanisms are introduced.
Validation
Latest local validation covers implementation commit
14455757af; current head317e1b82a9additionally removes the browser-origin section from the core package README. Snapshot updates were reviewed and the affected tests rerun.The repository SDK was used to build test projects. Tests were launched with the installed .NET 10 host because the repository-local SDK installation did not contain the required .NET 10 runtime. Quarantined and outerloop tests were excluded.
Exact local commands and results
Core endpoint references, manifest lowering, schema, and default compute-environment validation: passed, 195 tests.
Compose browser-origin coverage: passed, 15 tests. Kubernetes browser-origin coverage: passed, 40 tests. Radius browser-origin coverage: passed, 11 tests. Each corresponding project build succeeded. The test invocation below was executed for each listed project:
Entra provisioning class: 133 passed initially; the remaining test reported an expected Bicep snapshot change removing
first(split(...)). After reviewing the updated snapshot, its focused rerun passed. The project build succeeded.Generated SDK snapshots for TypeScript, Go, Java, Python, and Rust, plus the TypeScript browser-reference scanner check: passed, 6 tests in total. Each corresponding project build succeeded. The following invocation was executed for each language project after reviewing regenerated snapshots:
Deployment E2E project and Entra playground AppHost: builds passed. The playground build reported existing ILCompiler package vulnerability warnings.
The ACA starter and Foundry hosted-agent deployment scenarios now inject and assert
PrimaryBrowserOriginalongsideBrowserOrigins, but live deployment E2E tests were not run for the latest implementation. Earlier smoke/deployment evidence is available in the testing report and deployment run; those results predate the latest changes and do not validate them. The earlier run included a failing Sandbox port-exposure scenario.Checklist
<remarks />and<code />elements on your triple slash comments?