progmaweb
The site and account service of Progmasoft: a Next.js frontend and an ASP.NET Core API.
Clonegit clone https://git.progmasoft.com/progmaweb
Preserve the canonical account host across the internal Next.js rewrite by preferring the trusted X-Forwarded-Host value supplied by the dedicated Nginx proxy. This prevents the rewritten /account request from being misclassified as a corporate localhost request and eliminates the account root redirect loop while retaining the public-host isolation rule. Verified Prettier, ESLint, route generation, TypeScript, and the production frontend build.
- Commit
762890d8a3ad02d841d5b46fbbf578e35ffc8708- Author
- Leitwolf11 ·
- Parents
1ce38648d6e9
Changes
apps/web/proxy.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/web/proxy.ts b/apps/web/proxy.ts index 42249a2..06bbc8c 100644 --- a/apps/web/proxy.ts +++ b/apps/web/proxy.ts @@ -5,7 +5,9 @@ const accountHosts = new Set(["account.progmasoft.com", "account.localhost"]); export function proxy(request: NextRequest) { const host = - request.headers.get("host")?.split(":", 1)[0]?.toLowerCase() ?? ""; + (request.headers.get("x-forwarded-host") ?? request.headers.get("host")) + ?.split(":", 1)[0] + ?.toLowerCase() ?? ""; const pathname = request.nextUrl.pathname; // The account root has its own landing page, but authentication and dashboard URLs remain stable and readable.