質問編集履歴

1

・/etc/nginx/conf.d/*.conf で cable を再設定

2020/07/09 04:13

投稿

koki0502
koki0502

スコア19

test CHANGED
File without changes
test CHANGED
@@ -24,7 +24,7 @@
24
24
 
25
25
  ```
26
26
 
27
- WebSocket connection to 'wss://ドメイン/cable' failed: Error during WebSocket handshake: Unexpected response code: 404
27
+ WebSocket connection to 'wss://ドメイン/cable' failed: Error during WebSocket handshake: Unexpected response code: 502
28
28
 
29
29
  ```
30
30
 
@@ -46,6 +46,28 @@
46
46
 
47
47
  1.`config.action_cable.allowed_request_origins = [ 'http://example.com', /http://example.*/ ]`を有効にしドメインを設定
48
48
 
49
+ 2./etc/nginx/conf.d/*.confに下記を追加
50
+
51
+ ```
52
+
53
+ location /cable {
54
+
55
+ proxy_pass https://0.0.0.0:3000/cable;
56
+
57
+ proxy_http_version 1.1;
58
+
59
+ proxy_set_header Upgrade websocket;
60
+
61
+ proxy_set_header Connection Upgrade;
62
+
63
+ proxy_set_header X-Real-IP $remote_addr;
64
+
65
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
66
+
67
+ }
68
+
69
+ ```
70
+
49
71
 
50
72
 
51
73
  ###ご教示頂きたい点
@@ -58,8 +80,6 @@
58
80
 
59
81
  ・AWSのELB設定 (HTTP/HTTPSでのWebSockets通信はサポートしていない?)
60
82
 
61
- ・/etc/nginx/conf.d/*.conf で cable を設定
62
-
63
83
  ・redisの設定
64
84
 
65
85