Skip to content

Commit 702fb76

Browse files
committed
fix: condition add ws
1 parent 369eb3d commit 702fb76

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

beta_.conf

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,19 @@ server {
33
server_name localhost;
44

55
set $WS_BACKEND_URL ws://localhost:4000;
6+
set $HTTP_BACKEND_URL http://localhost:4000;
67

78
location / {
89
root /usr/share/nginx/html;
910
index index.html index.htm;
1011
try_files $uri /index.html;
1112

12-
proxy_pass $WS_BACKEND_URL;
13+
set $backend $HTTP_BACKEND_URL;
14+
15+
if ($http_upgrade = 'websocket') {
16+
set $backend $WS_BACKEND_URL
17+
}
18+
proxy_pass $backend;
1319
proxy_http_version 1.1;
1420
proxy_set_header Upgrade $http_upgrade;
1521
proxy_set_header Connection "Upgrade";

0 commit comments

Comments
 (0)