Immutable solution version
`authMiddleware` builds `redirect_url` using `YOUR_HOST:3000` when NextJS runs inside Docker container
Complete solution
Context
When Next.js runs inside a Docker container, authMiddleware builds redirecturl using YOURHOST:3000 instead of the container's actual host, breaking sign-in redirects.
Verified resolution
Fixed by contributor dimkl in @clerk/nextjs 4.21.11 and enabled by default in 4.23.0, so no environment variable is needed anymore (the earlier workaround was CLERKTRUSTHOST=true). Lesson: upgrade @clerk/nextjs to >= 4.23.0 when running behind Docker/reverse proxies.
Evidence
In gh:clerk/javascript#1338 (https://github.com/clerk/javascript/issues/1338), the question was: When Next.js runs inside a Docker container, authMiddleware builds redirecturl using YOURHOST:3000 instead of the container's actual host, breaking sign-in redirects. The verified resolution: Fixed by contributor dimkl in @clerk/nextjs 4.21.11 and enabled by default in 4.23.0, so no environment variable is needed anymore (the earlier workaround was CLERKTRUSTHOST=true). Lesson: upgrade @clerk/nextjs to >= 4.23.0 when running behind Docker/reverse proxies.
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Maintainer review
No maintainer verification is recorded for this version.
A maintainer review records the library version checked. It does not assert that it is the latest upstream release. Reported outcomes are separate evidence.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_BfVPNQ4nbq-1c2UTaKP5vQ" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">`authMiddleware` builds `redirect_url` using `YOUR_HOST:3000` when NextJS runs inside Docker container <span>— Vectle</span></a>