Add Aspire hostname routing for app.dev.localhost and back-office.dev.localhost#873
Open
Add Aspire hostname routing for app.dev.localhost and back-office.dev.localhost#873
Conversation
|
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

Route AppGateway by host header to enable subdomain access
Summary & Motivation
Local development previously exposed every self-contained system through the same hostname on different ports, so the browser saw
app,back-office, and the OAuth callback as a single origin. Cookies, CORS rules, and the OAuth-state flow had to fight that conflation, and the back-office experience was effectively unaddressable as its own product surface. This change introduces host-header-based routing in AppGateway soapp.dev.localhost,back-office.dev.localhost, and nakedlocalhostshare a single AppGateway port and resolve to the right backend cluster, with each subdomain behaving as a distinct origin.HostMatchConfigFilterandHostnamesOptionsto AppGateway, route the AppGateway request pipeline by host header, and updateappsettings.jsonto declare per-host clusters. UpdateAuthenticationCookieMiddlewareandAuthenticationTokenServiceso cookie issuance respects the canonical host. Add anAppGateway.Testssibling project (added to the solution) covering route configuration, host-match filtering, unknown-host fallback, and__Host-cookie path semanticsLocalhostRedirectMiddlewarethat 301-redirects naked-localhost requests toapp.dev.localhost, with covering tests inAppGateway.Tests. This is what makes the literal-localhostOAuth callback flow back to the canonical app host while preserving session cookies on the redirectlocalhostin development viaOAUTH_PUBLIC_URLset on the account-api in AppHost. Google's redirect_uri whitelist accepts only literallocalhost, not subdomains; the callback then 301's throughLocalhostRedirectMiddlewareso OAuth-state session cookies travel toapp.dev.localhostalong with the redirected requestDisplayOrder(Web App, Back Office, Open API), and updateConfigurationExtensionsto support the per-host configuration shapeuseUserMenuTenants,MobileMenu, andInvitationBannerso the new tenant's host context is applied; recognize any*.localhosthost as local development inmain/WebApp/routes/index.tsxEnd2EndCommand,McpCommand,RunCommand, andshared-webapp/tests/e2e/utils/constants.ts, replaceback-office/WebApp/tests/e2e/homepage.spec.tswithback-office-flows.spec.ts, and updategoogle-oauth-flows.spec.tsandpermission-based-ui-flows.spec.tsto the new host shape*.dev.localhostSAN is missing so existing developers' trust stores pick up the new subdomains automatically on first runThis change prepares the back-office surface for Entra ID login. Back-office is not yet served end-to-end -- a follow-up change will wire up authentication.
Checklist