From 98bba7d7fada74a7e4eaf478b12bd3bc629add12 Mon Sep 17 00:00:00 2001 From: hanhh <18330117883@163.com> Date: Wed, 13 Oct 2021 23:31:38 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0nginx=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .umirc.ts | 1 + docker/front.conf | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/.umirc.ts b/.umirc.ts index 1cc38f3c..998aaf6e 100644 --- a/.umirc.ts +++ b/.umirc.ts @@ -16,6 +16,7 @@ export default defineConfig({ '/api': { target: 'http://127.0.0.1:5600/', changeOrigin: true, + ws: true, }, }, chainWebpack: (config) => { diff --git a/docker/front.conf b/docker/front.conf index e87ceaa6..49388f38 100644 --- a/docker/front.conf +++ b/docker/front.conf @@ -2,6 +2,11 @@ upstream api { server 0.0.0.0:5600; } +map $http_upgrade $connection_upgrade { + default keep-alive; + 'websocket' upgrade; +} + server { listen 5700; root /ql/dist; @@ -12,6 +17,9 @@ server { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://api; + + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection $connection_upgrade; } location /open {