Commit ec81d62ea1c5b7738f48295521c730e0654f0078
1 parent
677bc5a4
Exists in
master
and in
1 other branch
fix websocket connection
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
config/nginx.conf
| @@ -26,6 +26,28 @@ server { | @@ -26,6 +26,28 @@ server { | ||
| 26 | proxy_pass http://puma; | 26 | proxy_pass http://puma; |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | + location @websocket { | ||
| 30 | + proxy_pass http://127.0.0.1:110; | ||
| 31 | + proxy_http_version 1.1; | ||
| 32 | + proxy_set_header Upgrade $http_upgrade; | ||
| 33 | + proxy_set_header Connection $connection_upgrade; | ||
| 34 | + proxy_set_header Host $host; | ||
| 35 | + proxy_set_header X-Real-IP $remote_addr; | ||
| 36 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| 37 | + break; | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + location /websocket { | ||
| 41 | + proxy_pass http://127.0.0.1:110/websocket; | ||
| 42 | + proxy_http_version 1.1; | ||
| 43 | + proxy_set_header X-Real-IP $remote_addr; | ||
| 44 | + add_header Access-Control-Allow-Origin *; | ||
| 45 | + proxy_set_header Upgrade websocket; | ||
| 46 | + proxy_set_header Connection Upgrade; | ||
| 47 | + proxy_set_header X-Real-IP $remote_addr; | ||
| 48 | + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
| 49 | + } | ||
| 50 | + | ||
| 29 | error_page 500 502 503 504 /500.html; | 51 | error_page 500 502 503 504 /500.html; |
| 30 | client_max_body_size 10M; | 52 | client_max_body_size 10M; |
| 31 | keepalive_timeout 10; | 53 | keepalive_timeout 10; |