fix: increase request body size limit to 500MB for video uploads

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Your Name 2026-01-31 21:32:07 +08:00
parent 4e42b3e1c1
commit db070f8a37
2 changed files with 14 additions and 6 deletions

View File

@ -279,9 +279,7 @@ export async function POST(request: NextRequest) {
}
}
// 配置较大的请求体限制
export const config = {
api: {
bodyParser: false,
},
};
// App Router 配置:增加请求体大小限制
// 参考: https://nextjs.org/docs/app/api-reference/file-conventions/route-segment-config
export const maxDuration = 300; // 5分钟超时
export const dynamic = "force-dynamic";

View File

@ -6,6 +6,16 @@ const nextConfig: NextConfig = {
typescript: {
ignoreBuildErrors: true, // 临时禁用类型检查以加快开发
},
// 增加请求体大小限制以支持大文件上传(视频等)
serverActions: {
bodySizeLimit: "500mb",
},
// 实验性功能:增加中间件和代理请求体大小限制
experimental: {
serverComponentsExternalPackages: ["sharp"],
middlewareClientMaxBodySize: "500mb", // 中间件请求体限制
proxyClientMaxBodySize: "500mb", // 代理请求体限制
},
images: {
remotePatterns: [
{