Files
jiang13-bbs/frontend/next.config.ts
freefire 61bf9fb48c feat(attach): 附件可配置限额、流式落盘与分阶段上传
管理端可配类型/体积;上传改流式避免整文件进内存;发帖先选再传并拦截未上传提交;提高 Next proxy 体积上限。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-17 07:33:16 +08:00

34 lines
942 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import type { NextConfig } from "next";
// 后端地址:开发环境兜底 localhost:3001,生产部署必须显式配置 BACKEND_URL
const API_TARGET =
process.env.BACKEND_URL || process.env.NEXT_PUBLIC_API_URL || "http://localhost:3001";
const nextConfig: NextConfig = {
images: {
minimumCacheTTL: 14400, // 4 小时
remotePatterns: [
{ protocol: "http", hostname: "localhost" },
],
},
experimental: {
// rewrite/proxy 默认只缓冲 10MB;附件上限由 Go 站点设置决定,此处留足余量(含 multipart 开销)
proxyClientMaxBodySize: "512mb",
},
async rewrites() {
return [
{
source: "/api/:path*",
destination: `${API_TARGET}/api/:path*`,
},
// 用户上传文件(头像等,全部 WebP)
{
source: "/uploads/:path*",
destination: `${API_TARGET}/uploads/:path*`,
},
];
},
};
export default nextConfig;