Skip to content

feat: redirect www.essentialcsharp.com to apex domain#1109

Merged
BenjaminMichaelis merged 2 commits into
mainfrom
feat/www-redirect-v2
May 16, 2026
Merged

feat: redirect www.essentialcsharp.com to apex domain#1109
BenjaminMichaelis merged 2 commits into
mainfrom
feat/www-redirect-v2

Conversation

@BenjaminMichaelis
Copy link
Copy Markdown
Member

Problem

\www.essentialcsharp.com\ currently returns a 404 (HTTP) or connection reset (HTTPS) because the Azure Container App doesn't handle the \www\ hostname.

Solution

Adds a 301 permanent redirect in the production middleware pipeline that strips the \www.\ prefix and redirects to the apex domain (\�ssentialcsharp.com).

Key details

  • Production only — inside the !IsDevelopment()\ block, local dev is unaffected
  • *After \UseForwardedHeaders* — so the real \Host\ header is readable behind the ACA ingress proxy
  • No new dependencies

Required Azure change (separate)

\www.essentialcsharp.com\ must be bound as a custom domain on the Azure Container App so traffic reaches the app at all (Azure will also provision a managed TLS cert).

Adds a 301 redirect in the production middleware pipeline that strips
the 'www.' prefix and redirects to the apex domain. Runs after
UseForwardedHeaders so the real Host header is available behind the
Azure Container Apps ingress proxy.
Copilot AI review requested due to automatic review settings May 15, 2026 07:10
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a production-only middleware that issues a 301 redirect from www.essentialcsharp.com to the apex domain, fixing the 404/connection reset users currently hit on the www. host. The middleware is placed after UseForwardedHeaders so the real Host header is observable behind the Azure Container Apps ingress proxy.

Changes:

  • Adds an inline app.Use middleware in the !IsDevelopment() branch that detects a www. host prefix and 301-redirects to the apex host, preserving scheme, path base, path, and query string.

Comment thread EssentialCSharp.Web/Program.cs Fixed
@BenjaminMichaelis BenjaminMichaelis requested a review from Copilot May 16, 2026 02:38
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated no new comments.

@BenjaminMichaelis BenjaminMichaelis merged commit 8fd1dd0 into main May 16, 2026
8 checks passed
@BenjaminMichaelis BenjaminMichaelis deleted the feat/www-redirect-v2 branch May 16, 2026 02:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants