diff --git a/apps/cm/app/api/proxy/[...url]/route.ts b/apps/cm/app/api/proxy/[...url]/route.ts index 761991e39..ca15a1447 100644 --- a/apps/cm/app/api/proxy/[...url]/route.ts +++ b/apps/cm/app/api/proxy/[...url]/route.ts @@ -101,11 +101,19 @@ async function handler( [AUTH_USER_ID]: userId, ...responseData, // 2FA 관련 추가 데이터 포함 }); + const hostname = window.location.hostname; + let domain = hostname === "localhost" || hostname === "127.0.0.1" ? undefined : hostname; + + // 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용 + if (hostname.includes("hasuon.or.kr")) { + domain = ".hasuon.or.kr"; + } if (refreshToken) { cookieStore.set(REFRESH_TOKEN, refreshToken, { httpOnly: true, sameSite: "lax", + domain: domain, path: "/", }); } diff --git a/apps/cs/app/api/proxy/[...url]/route.ts b/apps/cs/app/api/proxy/[...url]/route.ts index d3092c5c1..07fa4376f 100644 --- a/apps/cs/app/api/proxy/[...url]/route.ts +++ b/apps/cs/app/api/proxy/[...url]/route.ts @@ -60,10 +60,20 @@ async function handler( [AUTH_USER_ID]: userId, }); + + const hostname = window.location.hostname; + let domain = hostname === "localhost" || hostname === "127.0.0.1" ? undefined : hostname; + + // 운영 환경에서는 서브도메인을 포함한 최상위 도메인 사용 + if (hostname.includes("hasuon.or.kr")) { + domain = ".hasuon.or.kr"; + } + if (refreshToken) { cookieStore.set(REFRESH_TOKEN, refreshToken, { httpOnly: true, sameSite: "lax", + domain: domain, path: "/", }); } @@ -83,6 +93,7 @@ async function handler( } } + export async function POST( request: Request, props: { params: Promise<{ url: string[] }> },