260826_01_ENH: 파일 패스를 api방식이 아닌 rewrite로 우회 하도록 수정
This commit is contained in:
@@ -251,6 +251,13 @@ When implementation is complete, report in Korean:
|
||||
- Validate external data at runtime; a shared TypeScript type alone does not validate an API response or persisted value.
|
||||
- Prefer named public exports and retain the consumer project's current module system and bundler conventions.
|
||||
|
||||
### React Compiler and Manual Memoization
|
||||
|
||||
- `createKriNextConfig` enables `reactCompiler: true` unless the project overrides it; confirm the effective configuration.
|
||||
- When enabled, rely on React Compiler instead of adding `useMemo`, `useCallback`, or `React.memo` as a routine performance precaution.
|
||||
- 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.
|
||||
|
||||
### Change Safety
|
||||
|
||||
- Pin or constrain the package version according to the consumer repository's dependency policy and commit its lockfile changes.
|
||||
|
||||
@@ -1,6 +1,19 @@
|
||||
import type { NextConfig } from "next";
|
||||
import { createKriNextConfig } from "@kri/common/config";
|
||||
import {createEnv, createKriNextConfig, env} from "@kri/common/config";
|
||||
|
||||
const nextConfig = createKriNextConfig({}) satisfies NextConfig;
|
||||
const nextEnv = createEnv({
|
||||
CONTACT_SERVER: env.required("CONTACT_SERVER", process.env.CONTACT_SERVER),
|
||||
});
|
||||
|
||||
const nextConfig = createKriNextConfig({
|
||||
async rewrites() {
|
||||
return [
|
||||
{
|
||||
source: "/files/:path*",
|
||||
destination: `${nextEnv.CONTACT_SERVER}/files/:path*`,
|
||||
},
|
||||
];
|
||||
},
|
||||
}) satisfies NextConfig;
|
||||
|
||||
export default nextConfig;
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
// 백엔드(파일 서버)가 테스트/운영 환경에서 내부망 전용 주소라 브라우저가 직접 접근할 수 없다.
|
||||
// 프론트 자기 origin의 BFF 프록시(src/app/api/files/[...slug]/route.ts)를 거쳐 내려받는다.
|
||||
// 백엔드의 상대 파일 경로는 next.config.ts의 rewrite를 통해 프론트 origin에서 내려받는다.
|
||||
export function toFileDownloadUrl(downloadUrl: string): string {
|
||||
return `/api${downloadUrl}`;
|
||||
return downloadUrl;
|
||||
}
|
||||
|
||||
// 백엔드가 Content-Disposition: attachment를 내려주지 않아 PDF 등은 새 탭에 그냥 열려버린다.
|
||||
|
||||
Reference in New Issue
Block a user