我在Rails 5.0.0上创建了一个项目.
此外,我所做的与本视频完全相同:https://www.youtube.com/watch?v=n0WUjGkDFS0
我也同时阅读:https://github.com/rails/rails/tree/master/actioncable
在routes.rb中,我添加了以下行:
挂载ActionCable.server => ‘/电缆’
在application.rb中,我添加了以下行:
config.action_cable.mount_path =’/电缆’
结果,我运行了此命令的项目:
rails服务器-b SERVER_IP -p 3020
WebSocket connection to ‘ws://site.com/cable’ Failed: Unexpected response code: 404
通过运行项目的一部分日志:
Started GET "/cable" for SERVER_IP at 2016-07-12 16:20:14 +0300
Cannot render console from SERVER_IP! Allowed networks: 127.0.0.1,::1,127.0.0.0/127.255.255.255
Started GET "/cable/" [WebSocket] for SERVER_IP at 2016-07-12 16:20:14 +0300
Request origin not allowed: example.com
Failed to upgrade to WebSocket (REQUEST_METHOD: GET,HTTP_CONNECTION: upgrade,HTTP_UPGRADE: websocket)
Finished "/cable/" [WebSocket] for SERVER_IP at 2016-07-12 16:20:14 +0300
错误可能是什么?我究竟做错了什么?
定义:
> SERVER_IP-这掩盖了服务器的原始IP地址.
> example.com-这掩盖了网站的原始URL.
最佳答案
原文链接:https://www.f2er.com/nginx/532312.html