fix(aia,ssa,asl,infra): harden SSE transport and stabilize attachment context

Deliver SSE protocol hardening for SAE/HTTP2 paths, add graceful shutdown health behavior, and improve SSA retry UX for transient stream failures. For AIA, persist attachment extraction results in database with cache read-through fallback, plus production cache safety guard to prevent memory-cache drift in multi-instance deployments; also restore ASL SR page scrolling behavior.

Made-with: Cursor
This commit is contained in:
2026-03-09 18:45:12 +08:00
parent 50657dd81f
commit 5c5fec52c1
27 changed files with 807 additions and 100 deletions

View File

@@ -17,6 +17,13 @@ http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
# WebSocket / SSE 兼容:仅当请求包含 Upgrade 头时设置 Connection: upgrade
# SSE 请求无 Upgrade 头 → Connection 为空,避免 HTTP/2 帧协议错误
map $http_upgrade $connection_upgrade {
default upgrade;
'' '';
}
# ⚠️ 文件上传大小限制(默认只有 1MB太小会导致 413 错误)
client_max_body_size 50M; # 允许上传最大 50MB 文件
@@ -144,14 +151,15 @@ http {
proxy_send_timeout 300s;
proxy_read_timeout 300s;
# 缓冲配置
proxy_buffering off; # 关闭缓冲(实时流式响应)
proxy_request_buffering off; # 支持大文件上传
# 缓冲配置SSE 流式响应必须关闭所有缓冲/缓存)
proxy_buffering off;
proxy_cache off;
proxy_request_buffering off;
# WebSocket 支持(如果后续需要)
# WebSocket + SSE 兼容
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_set_header Connection $connection_upgrade;
# 错误处理
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;