站点/后台分轨背景与用户列表排序一并落地;生产 CORS 改走 SITE_URL,健康检查带版本号。 Co-authored-by: Cursor <cursoragent@cursor.com>
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
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 = {
|
||
// 官方 Docker 运行时:最小产物,不含完整 node_modules。next dev 忽略此项。
|
||
output: "standalone",
|
||
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;
|