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
This commit is contained in:
@@ -17,6 +17,9 @@ http {
|
|||||||
include /etc/nginx/mime.types;
|
include /etc/nginx/mime.types;
|
||||||
default_type application/octet-stream;
|
default_type application/octet-stream;
|
||||||
|
|
||||||
|
# ⚠️ 文件上传大小限制(默认只有 1MB,太小会导致 413 错误)
|
||||||
|
client_max_body_size 50M; # 允许上传最大 50MB 文件
|
||||||
|
|
||||||
# 日志格式
|
# 日志格式
|
||||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||||
'$status $body_bytes_sent "$http_referer" '
|
'$status $body_bytes_sent "$http_referer" '
|
||||||
@@ -101,6 +104,9 @@ http {
|
|||||||
|
|
||||||
# 后端 API 代理(关键配置)
|
# 后端 API 代理(关键配置)
|
||||||
location /api/ {
|
location /api/ {
|
||||||
|
# 文件上传大小限制(PKB 文档上传等场景)
|
||||||
|
client_max_body_size 50M;
|
||||||
|
|
||||||
# 代理到后端服务
|
# 代理到后端服务
|
||||||
proxy_pass http://backend;
|
proxy_pass http://backend;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user