diff --git a/src/app/api/auth/refresh/route.js b/src/app/api/auth/refresh/route.js index d325b4b..f65cb85 100644 --- a/src/app/api/auth/refresh/route.js +++ b/src/app/api/auth/refresh/route.js @@ -5,6 +5,7 @@ const API_BASE_URL = 'https://gdgocinha.site/auth'; // 프록시 대상 주소 export async function POST(req) { const targetUrl = `${API_BASE_URL}/refresh`; + const isProd = process.env.NODE_ENV === 'production'; try { const cookies = req.headers.get('cookie') || ''; @@ -33,8 +34,8 @@ export async function POST(req) { nextResponse.cookies.set(name, value, { path: '/', httpOnly: true, - secure: process.env.NODE_ENV === 'production', - sameSite: 'strict', + secure: isProd, + sameSite: isProd ? 'none' : 'lax', }); }); } diff --git a/src/app/api/signin/route.js b/src/app/api/signin/route.js index 0431d4d..de80c8e 100644 --- a/src/app/api/signin/route.js +++ b/src/app/api/signin/route.js @@ -7,6 +7,7 @@ export async function POST(request) { try { // 클라이언트로부터 받은 요청 데이터 추출 const { email, password } = await request.json(); + const isProd = process.env.NODE_ENV === 'production'; // gdgocinha.site/auth/login으로 요청 전달 const response = await axios.post( @@ -30,18 +31,18 @@ export async function POST(request) { // 원본 응답의 쿠키가 있으면 추출하여 현재 도메인에 설정 const cookies = response.headers['set-cookie']; if (cookies) { - cookies.forEach(cookie => { + cookies.forEach((cookie) => { // 쿠키 문자열에서 이름과 값 부분만 추출 const cookieParts = cookie.split(';')[0].split('='); const cookieName = cookieParts[0]; const cookieValue = cookieParts.slice(1).join('='); - + // 추출한 쿠키를 현재 도메인에 설정 nextResponse.cookies.set(cookieName, cookieValue, { path: '/', httpOnly: true, - secure: process.env.NODE_ENV === 'production', - sameSite: 'strict', + secure: isProd, + sameSite: isProd ? 'none' : 'lax', }); }); } diff --git a/src/app/study/create/page.jsx b/src/app/study/create/page.jsx index 806f4dc..28be6b3 100644 --- a/src/app/study/create/page.jsx +++ b/src/app/study/create/page.jsx @@ -91,8 +91,6 @@ export default function CreateStudy() { imagePath: getS3Key }; - console.log(updateFormData); - await apiClient.post('/study', updateFormData); alert("스터디 개설이 완료되었습니다!");