From 970750a0871a11206443233f6f797ef376b31fc4 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Wed, 26 Aug 2026 10:50:22 +0900 Subject: [PATCH] =?UTF-8?q?260826=5F02=5FENH:=20=EA=B8=B0=EC=A1=B4=20?= =?UTF-8?q?=EC=9A=B0=ED=9A=8C=20=EB=9D=BC=EC=9A=B0=ED=8A=B8=20=EC=A0=9C?= =?UTF-8?q?=EA=B1=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AGENTS.md | 4 ++++ next.config.ts | 4 ++-- src/app/api/files/[...slug]/route.ts | 36 ---------------------------- 3 files changed, 6 insertions(+), 38 deletions(-) delete mode 100644 src/app/api/files/[...slug]/route.ts diff --git a/AGENTS.md b/AGENTS.md index 7089400..24da8b8 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -258,6 +258,10 @@ When implementation is complete, report in Korean: - Use manual memoization only for required reference stability, an Effect or third-party contract, compiler-incompatible code, or a measured performance problem. - Preserve existing memoization unless approved and verified for removal. Use `"use memo"` or `"use no memo"` only for a documented compiler boundary. +### Project Instruction Budget + +- Keep `.agent/project.md` at or below 8 KiB (8,192 bytes) as the normal target. Do not delete material rules merely to meet the budget; move schemas, endpoint inventories, examples, and temporary issue history to linked project documentation, and keep concise read-routing instructions here. + ### Change Safety - Pin or constrain the package version according to the consumer repository's dependency policy and commit its lockfile changes. diff --git a/next.config.ts b/next.config.ts index 564c5e1..9490296 100644 --- a/next.config.ts +++ b/next.config.ts @@ -2,7 +2,7 @@ import type { NextConfig } from "next"; import {createEnv, createKriNextConfig, env} from "@kri/common/config"; const nextEnv = createEnv({ - CONTACT_SERVER: env.required("CONTACT_SERVER", process.env.CONTACT_SERVER), + API_SERVER: env.required("API_SERVER", process.env.API_SERVER), }); const nextConfig = createKriNextConfig({ @@ -10,7 +10,7 @@ const nextConfig = createKriNextConfig({ return [ { source: "/files/:path*", - destination: `${nextEnv.CONTACT_SERVER}/files/:path*`, + destination: `${nextEnv.API_SERVER}/files/:path*`, }, ]; }, diff --git a/src/app/api/files/[...slug]/route.ts b/src/app/api/files/[...slug]/route.ts deleted file mode 100644 index 60e7bfc..0000000 --- a/src/app/api/files/[...slug]/route.ts +++ /dev/null @@ -1,36 +0,0 @@ -import { cookies } from "next/headers"; -import { NextRequest, NextResponse } from "next/server"; -import { serverEnv } from "@/lib/env.server"; -import { CookieKeys } from "@/store/cookie/cookie-keys"; -import type { RouteContext } from "@/types/common"; - -// 파일 서버(백엔드와 동일 호스트)가 테스트/운영 환경에서 내부망 전용이라 브라우저가 직접 접근할 수 없다. -// 내부망에 접근 가능한 건 이 Next.js 서버뿐이므로, 여기서 대신 받아 그대로 스트리밍해서 전달한다. -export async function GET(request: NextRequest, context: RouteContext) { - const { slug = [] } = await context.params; - if (!slug.length) return new NextResponse(null, { status: 404 }); - - const fileOrigin = new URL(serverEnv.API_SERVER).origin; - const targetUrl = `${fileOrigin}/files/${slug.map(encodeURIComponent).join("/")}${request.nextUrl.search}`; - - const cookieStore = await cookies(); - const accessToken = cookieStore.get(CookieKeys.AuthToken)?.value; - - const backendResponse = await fetch(targetUrl, { - headers: accessToken ? { authorization: `Bearer ${accessToken}` } : undefined, - }); - - if (!backendResponse.ok || !backendResponse.body) { - return new NextResponse(null, { status: backendResponse.status }); - } - - return new NextResponse(backendResponse.body, { - status: backendResponse.status, - headers: { - "content-type": backendResponse.headers.get("content-type") ?? "application/octet-stream", - ...(backendResponse.headers.get("content-length") - ? { "content-length": backendResponse.headers.get("content-length")! } - : {}), - }, - }); -}