From 58c17c391a71b9a5a55dd71a101e001e67d00cf9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=AD=99=E5=B0=8F=E4=BA=91?= Date: Fri, 30 Jan 2026 17:45:45 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0websocket?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docker/nginx/conf/nginx.conf | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docker/nginx/conf/nginx.conf b/docker/nginx/conf/nginx.conf index 8102642..444a937 100644 --- a/docker/nginx/conf/nginx.conf +++ b/docker/nginx/conf/nginx.conf @@ -20,6 +20,26 @@ http { 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/{ proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr;