Ninvfeng Blog

记录web开发中的所见所得

Nginx支持sse配置

location / {

proxy_pass http://127.0.0.1:8100;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

# 添加以下配置以处理SSE
proxy_set_header Connection '';
proxy_http_version 1.1;  # 重要:确保使用HTTP/1.1协议
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_buffering off;
proxy_cache off;

}

文章评论已关闭!