不允许使用“ Rails操作电缆请求来源”>

问题描述 投票:1回答:1

我正在尝试在仅api的rails应用程序中配置操作电缆。经过最基本的设置后,我尝试从Ember应用程序连接到服务器。它无法连接,在Rails控制台上,我看到以下错误条目:

Started GET "/cable" for 172.17.0.1 at 2017-12-20 10:17:26 +0000
Started GET "/cable/" [WebSocket] for 172.17.0.1 at 2017-12-20 10:17:26 Request origin not allowed: http://localhost:4200
Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: websocket)
Finished "/cable/" [WebSocket] for 172.17.0.1 at 2

快速搜索后(后面是一个全面的搜索结果,解决方案看起来很简单。在config / development.rb中添加以下行,应予以解决:

config.action_cable.allowed_request_origins = ['http://localhost:4200']

((注:4200是ember服务器运行的端口,请求来自该端口,rails在standad 3000端口上运行)。但是,问题仍然存在。我尝试了很多可以在互联网上找到的东西,但问题仍然存在。

谢谢

我正在尝试在仅api的rails应用程序中配置操作电缆。经过最基本的设置后,我尝试从Ember应用程序连接到服务器。它无法连接,并且在Rails控制台上I ...

ruby-on-rails actioncable
1个回答
0
投票

看起来像问题不是滑轨,而是库https://github.com/rails/rails/issues/31524

© www.soinside.com 2019 - 2024. All rights reserved.