diff --git a/packages/next-auth/src/core/index.ts b/packages/next-auth/src/core/index.ts index 99e477984b..27ff069f97 100644 --- a/packages/next-auth/src/core/index.ts +++ b/packages/next-auth/src/core/index.ts @@ -77,6 +77,11 @@ async function toInternalRequest( query, } } + + const { headers } = req + const host = headers?.["x-forwarded-host"] ?? headers?.host + req.origin = detectOrigin(host, headers?.["x-forwarded-proto"]) + return req }