mirror of
https://github.com/Wei-Shaw/claude-relay-service.git
synced 2026-01-22 16:40:25 +00:00
@@ -61,6 +61,9 @@ PROXY_USE_IPV4=true
|
||||
# ⏱️ 请求超时配置
|
||||
REQUEST_TIMEOUT=600000 # 请求超时设置(毫秒),默认10分钟
|
||||
|
||||
# 🔧 请求体大小配置
|
||||
REQUEST_MAX_SIZE_MB=60
|
||||
|
||||
# 📈 使用限制
|
||||
DEFAULT_TOKEN_LIMIT=1000000
|
||||
|
||||
|
||||
@@ -21,6 +21,9 @@ services:
|
||||
- PORT=3000
|
||||
- HOST=0.0.0.0
|
||||
|
||||
# 🔧 请求体大小配置
|
||||
- REQUEST_MAX_SIZE_MB=60
|
||||
|
||||
# 🔐 安全配置(必填)
|
||||
- JWT_SECRET=${JWT_SECRET} # 必填:至少32字符的随机字符串
|
||||
- ENCRYPTION_KEY=${ENCRYPTION_KEY} # 必填:32字符的加密密钥
|
||||
|
||||
@@ -1388,7 +1388,8 @@ const globalRateLimit = async (req, res, next) =>
|
||||
|
||||
// 📊 请求大小限制中间件
|
||||
const requestSizeLimit = (req, res, next) => {
|
||||
const maxSize = 60 * 1024 * 1024 // 60MB
|
||||
const MAX_SIZE_MB = parseInt(process.env.REQUEST_MAX_SIZE_MB || '60', 10)
|
||||
const maxSize = MAX_SIZE_MB * 1024 * 1024
|
||||
const contentLength = parseInt(req.headers['content-length'] || '0')
|
||||
|
||||
if (contentLength > maxSize) {
|
||||
|
||||
Reference in New Issue
Block a user