添加websocket

This commit is contained in:
孙小云 2026-01-30 17:45:45 +08:00
parent 4af39290ef
commit 58c17c391a
1 changed files with 20 additions and 0 deletions

View File

@ -20,6 +20,26 @@ http {
index index.html index.htm; index index.html index.htm;
} }
# WebSocket 配置 (必须放在 /prod-api/ 之前)
location /prod-api/websocket/ {
proxy_pass http://ruoyi-gateway:8080/websocket/;
# WebSocket 必需的配置
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
# 其他代理头
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;
# 超时设置WebSocket 长连接)
proxy_connect_timeout 60s;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
}
location /prod-api/{ location /prod-api/{
proxy_set_header Host $http_host; proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Real-IP $remote_addr;