fix: 修复 nginx SSE 配置(添加 HTTP/1.1,移除冗余配置)
This commit is contained in:
@@ -9,11 +9,11 @@ purpose: 记录 nginx 配置优化,禁用 SSE 响应缓冲
|
||||
**文件:** `/etc/nginx/sites-enabled/lifescript.happylifeos.com.conf`
|
||||
|
||||
**变更内容:**
|
||||
在 `location /api/shortNovel/` 块中添加了以下配置:
|
||||
在 `location /api/shortNovel/` 块中使用以下配置:
|
||||
- `proxy_http_version 1.1;` - 确保 SSE 长连接使用 HTTP/1.1
|
||||
- `proxy_buffering off;` - 禁用代理缓冲
|
||||
- `proxy_cache off;` - 禁用缓存
|
||||
- `chunked_transfer_encoding on;` - 启用分块传输编码
|
||||
- `proxy_set_header Connection '';` - 清除 Connection 头
|
||||
- `proxy_set_header Connection "keep-alive";` - 保持上游连接
|
||||
|
||||
**原因:**
|
||||
- nginx 默认启用 `proxy_buffering on`,会缓冲后端响应
|
||||
|
||||
Reference in New Issue
Block a user