From 6e343d80005a505e752239b52713542d29de1ac0 Mon Sep 17 00:00:00 2001 From: Chuseok22 Date: Tue, 16 Sep 2025 13:08:51 +0900 Subject: [PATCH 1/3] =?UTF-8?q?BFF=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20API=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99=20=EB=B0=8F=20JWT=20=EA=B8=B0=EB=B0=98=20Aut?= =?UTF-8?q?horization=20=EC=B2=98=EB=A6=AC=20:=20feat=20:=20=EB=A1=9C?= =?UTF-8?q?=EA=B7=B8=EC=9D=B8=20=EC=97=90=EB=9F=AC=20=EC=83=81=ED=83=9C=20?= =?UTF-8?q?401=20=EC=88=98=EC=A0=95=20https://github.com/TEAM-ROMROM/RomRo?= =?UTF-8?q?m-Admin/issues/4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/lib/error/error-code.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib/error/error-code.ts b/src/lib/error/error-code.ts index 9e7d8f5..37a97b1 100644 --- a/src/lib/error/error-code.ts +++ b/src/lib/error/error-code.ts @@ -10,7 +10,7 @@ export const ERROR_CODES = { INVALID_REQUEST: {status: 400, message: '유효하지 않은 요청입니다.'}, // AUTH - LOGIN_FAILED: {status: 400, message: '로그인에 실패했습니다'}, + LOGIN_FAILED: {status: 401, message: '로그인에 실패했습니다'}, } as const; export type ErrorCodeKey = keyof typeof ERROR_CODES; From c7166a2a792e7eee787ba6d7f485ebbfee0e9b46 Mon Sep 17 00:00:00 2001 From: Chuseok22 Date: Tue, 16 Sep 2025 13:24:28 +0900 Subject: [PATCH 2/3] =?UTF-8?q?BFF=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20API=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99=20=EB=B0=8F=20JWT=20=EA=B8=B0=EB=B0=98=20Aut?= =?UTF-8?q?horization=20=EC=B2=98=EB=A6=AC=20:=20feat=20:=20build=20?= =?UTF-8?q?=EC=98=A4=EB=A5=98=20=ED=95=B4=EA=B2=B0=20https://github.com/TE?= =?UTF-8?q?AM-ROMROM/RomRom-Admin/issues/4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/api/[...path]/route.ts | 12 ++++++------ src/lib/bff/proxy.ts | 5 +++-- src/lib/bff/types.ts | 4 +--- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/src/app/api/[...path]/route.ts b/src/app/api/[...path]/route.ts index 3c8af8b..2ccf751 100644 --- a/src/app/api/[...path]/route.ts +++ b/src/app/api/[...path]/route.ts @@ -10,26 +10,26 @@ const proxy = createProxy({ stripRequestHeaders: ['content-length'], }); -export function GET(req: NextRequest, ctx: ProxyContext): Promise { +export async function GET(req: NextRequest, ctx: ProxyContext): Promise { return proxy(req, ctx); } -export function POST(req: NextRequest, ctx: ProxyContext): Promise { +export async function POST(req: NextRequest, ctx: ProxyContext): Promise { return proxy(req, ctx); } -export function PUT(req: NextRequest, ctx: ProxyContext): Promise { +export async function PUT(req: NextRequest, ctx: ProxyContext): Promise { return proxy(req, ctx); } -export function PATCH(req: NextRequest, ctx: ProxyContext): Promise { +export async function PATCH(req: NextRequest, ctx: ProxyContext): Promise { return proxy(req, ctx); } -export function DELETE(req: NextRequest, ctx: ProxyContext): Promise { +export async function DELETE(req: NextRequest, ctx: ProxyContext): Promise { return proxy(req, ctx); } -export function OPTIONS(req: NextRequest, ctx: ProxyContext): Promise { +export async function OPTIONS(req: NextRequest, ctx: ProxyContext): Promise { return proxy(req, ctx); } \ No newline at end of file diff --git a/src/lib/bff/proxy.ts b/src/lib/bff/proxy.ts index c530d45..a4a5137 100644 --- a/src/lib/bff/proxy.ts +++ b/src/lib/bff/proxy.ts @@ -1,4 +1,4 @@ -import { NextResponse, type NextRequest } from 'next/server'; +import { type NextRequest, NextResponse } from 'next/server'; import type { ProxyConfig, ProxyContext, ProxyHandler } from './types'; /** URL 안전 결합 (중복 슬래시 제거) */ @@ -50,7 +50,8 @@ export function createProxy(config: ProxyConfig): ProxyHandler { const backendHost = backendUrl.host; return async (req: NextRequest, ctx: ProxyContext): Promise => { - const path = (ctx.params?.path ?? []).join('/'); + const { path: segs } = await ctx.params; + const path = Array.isArray(segs) ? segs.join('/') : ''; const target = joinUrl(config.backendBaseUrl, path, new URL(req.url).search); const upstreamHeaders = buildUpstreamHeaders(req, backendHost, config); diff --git a/src/lib/bff/types.ts b/src/lib/bff/types.ts index 6343b0f..6ed83bb 100644 --- a/src/lib/bff/types.ts +++ b/src/lib/bff/types.ts @@ -2,9 +2,7 @@ import { NextRequest } from "next/server"; export interface ProxyContext { - readonly params: { - readonly path: string[]; - }; + readonly params: Promise<{ path: string[] }> } // 프록시 실행에 필요한 설정 From 6130448dd03fb985bd3b43145ebcd7ad77265c80 Mon Sep 17 00:00:00 2001 From: Chuseok22 Date: Tue, 16 Sep 2025 13:26:20 +0900 Subject: [PATCH 3/3] =?UTF-8?q?BFF=20=EB=A1=9C=EA=B7=B8=EC=9D=B8=20API=20?= =?UTF-8?q?=EC=97=B0=EB=8F=99=20=EB=B0=8F=20JWT=20=EA=B8=B0=EB=B0=98=20Aut?= =?UTF-8?q?horization=20=EC=B2=98=EB=A6=AC=20:=20cicd=20:=20main=20?= =?UTF-8?q?=EB=B8=8C=EB=9E=9C=EC=B9=98=20pr=20=EC=8B=9C=20CI=20=EB=B9=8C?= =?UTF-8?q?=EB=93=9C=20=EA=B2=80=EC=A6=9D=20=EC=B6=94=EA=B0=80=20https://g?= =?UTF-8?q?ithub.com/TEAM-ROMROM/RomRom-Admin/issues/4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/RomRom-ADMIN-CI.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/RomRom-ADMIN-CI.yml b/.github/workflows/RomRom-ADMIN-CI.yml index 5dacb5d..977ad33 100644 --- a/.github/workflows/RomRom-ADMIN-CI.yml +++ b/.github/workflows/RomRom-ADMIN-CI.yml @@ -4,6 +4,7 @@ on: pull_request: branches: - test + - main jobs: build: