在我的config/environments/development.rb文件中,我添加了
config.action_cable.url = "ws://lab.lizardgizzards.com:4001/cable"
使用一个名为actioncable-vue的Vue模块,我尝试让我的Vue前端使用我在Rails中创建的Action Cable API。
这是我在vue前端的浏览器控制台中看到的错误:
WebSocket connection to 'ws://lab.lizardgizzards.com:4001/cable' failed: Error during WebSocket handshake: Unexpected response code: 404
我确实收到了http://lab.lizardgizzards.com:4001的回复
发布于 2019-08-05 04:53:55
修复非常简单,只需将此代码添加到config/environments/development.rb中
config.action_cable.allowed_request_origins = [/http:\/\/*/, /https:\/\/*/]
https://stackoverflow.com/questions/57349909
复制相似问题