From 5d5a174dd743e2c46e254ddbedc9dad33fde0c34 Mon Sep 17 00:00:00 2001 From: HaHafeng Date: Tue, 27 Jan 2026 21:23:59 +0800 Subject: [PATCH] fix(frontend): Add client_max_body_size to fix 413 error on file upload Problem: PKB document upload fails with HTTP 413 in SAE environment Root cause: Nginx default client_max_body_size is only 1MB Solution: Add client_max_body_size 50M in http block and location /api/ block --- frontend-v2/nginx.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/frontend-v2/nginx.conf b/frontend-v2/nginx.conf index 2487a49c..adefb978 100644 --- a/frontend-v2/nginx.conf +++ b/frontend-v2/nginx.conf @@ -17,6 +17,9 @@ http { include /etc/nginx/mime.types; default_type application/octet-stream; + # ⚠️ 文件上传大小限制(默认只有 1MB,太小会导致 413 错误) + client_max_body_size 50M; # 允许上传最大 50MB 文件 + # 日志格式 log_format main '$remote_addr - $remote_user [$time_local] "$request" ' '$status $body_bytes_sent "$http_referer" ' @@ -101,6 +104,9 @@ http { # 后端 API 代理(关键配置) location /api/ { + # 文件上传大小限制(PKB 文档上传等场景) + client_max_body_size 50M; + # 代理到后端服务 proxy_pass http://backend;