From ca0f12774be3083e596a8ff8c2c465d205175432 Mon Sep 17 00:00:00 2001 From: hamster1963 <1410514192@qq.com> Date: Mon, 21 Oct 2024 11:28:44 +0800 Subject: [PATCH] fix: docker auth_url --- app/api/auth/[...nextauth]/route.ts | 21 +-------------------- 1 file changed, 1 insertion(+), 20 deletions(-) diff --git a/app/api/auth/[...nextauth]/route.ts b/app/api/auth/[...nextauth]/route.ts index 4ddc1da..86c9f3d 100644 --- a/app/api/auth/[...nextauth]/route.ts +++ b/app/api/auth/[...nextauth]/route.ts @@ -1,22 +1,3 @@ import { handlers } from "@/auth"; -import { NextRequest } from "next/server"; -const reqWithTrustedOrigin = (req: NextRequest): NextRequest => { - const proto = req.headers.get("x-forwarded-proto"); - const host = req.headers.get("x-forwarded-host"); - if (!proto || !host) { - console.warn("Missing x-forwarded-proto or x-forwarded-host headers."); - return req; - } - const envOrigin = `${proto}://${host}`; - const { href, origin } = req.nextUrl; - return new NextRequest(href.replace(origin, envOrigin), req); -}; - -export const GET = (req: NextRequest) => { - return handlers.GET(reqWithTrustedOrigin(req)); -}; - -export const POST = (req: NextRequest) => { - return handlers.POST(reqWithTrustedOrigin(req)); -}; +export const { GET, POST } = handlers;