我正在尝试将Rails 5.1.4应用程序部署到AWS Elastic Beanstalk,但无法使ActionCable工作。根据Rails日志,将HTTP连接升级到WebSocket似乎存在问题:
I, [2017-11-29T20:53:23.533734 #6275] INFO -- : [014bad33-65a1-489e-9108-dc4157965491] Started GET "/cable" for 24.192.57.23 at 2017-11-29 20:53:23 +0000
I, [2017-11-29T20:53:23.534481 #6275] INFO -- : [014bad33-65a1-489e-9108-dc4157965491] Started GET "/cable/"[non-WebSocket] for 24.192.57.23 at 2017-11-29 20:53:23 +0000
E, [2017-11-29T20:53:23.534582 #6275] ERROR -- : [014bad33-65a1-489e-9108-dc4157965491] Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: close, HTTP_UPGRADE: )
I, [2017-11-29T20:53:23.534721 #6275] INFO -- : [014bad33-65a1-489e-9108-dc4157965491] Finished "/cable/"[non-WebSocket] for 24.192.57.23 at 2017-11-29 20:53:23 +0000
Elastic Beanstalk配置使用ALB(不是ELB),它应该与开箱即用的WebSockets一起使用。
我尝试过使用带有TCP而非HTTP的ELB,configuring nginx reverse proxy和modifying application settings都没有成功。围绕反向代理似乎存在共识,但我似乎无法使咒语正确。
请帮忙!