From dd25c3bdfbb51b546b1dc02f2f84970d413938b0 Mon Sep 17 00:00:00 2001 From: WooWan Date: Tue, 6 Aug 2024 19:44:29 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20ROOT=5FDOMAIN=20=ED=99=98=EA=B2=BD?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EC=A0=9C=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.template | 2 -- src/middleware.ts | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.env.template b/.env.template index b245079..e4b203f 100644 --- a/.env.template +++ b/.env.template @@ -27,5 +27,3 @@ NAVER_REDIRECT_URI= KAKAO_MAP_BASE_URL= KAKAO_MAP_API_KEY= DAUMCDN_POSTOCDE_URL= - -ROOT_DOMAIN= \ No newline at end of file diff --git a/src/middleware.ts b/src/middleware.ts index 5a49700..aff80a5 100644 --- a/src/middleware.ts +++ b/src/middleware.ts @@ -7,9 +7,7 @@ export const config = { export function middleware(request: NextRequest) { const url = request.nextUrl; - const hostname = request.headers - .get("host")! - .replace(".localhost:3000", `.${process.env.ROOT_DOMAIN}`); + const hostname = request.headers.get("host")!; const searchParams = request.nextUrl.searchParams.toString(); const path = `${url.pathname}${ @@ -17,6 +15,8 @@ export function middleware(request: NextRequest) { }`; const subDomain = hostname.split(".")[0]; + console.log("subDomain", subDomain, "hostname", hostname); + switch (true) { case subDomain !== hostname: return NextResponse.rewrite(