diff options
| author | Leitwolf11 | 2026-08-28 23:55:52 +0300 |
|---|---|---|
| committer | Leitwolf11 | 2026-08-28 23:55:52 +0300 |
| commit | 762890d8a3ad02d841d5b46fbbf578e35ffc8708 (patch) | |
| tree | fd38a17a373aecebfbf0205eb45822c4356ec6d3 /apps | |
| parent | 1ce38648d6e987aaaa06d7d4fff461ef862f9a93 (diff) | |
| download | progmaweb-762890d8a3ad02d841d5b46fbbf578e35ffc8708.tar.gz | |
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.
Diffstat (limited to 'apps')
| -rw-r--r-- | apps/web/proxy.ts | 4 |
1 files changed, 3 insertions, 1 deletions
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. |