在Rails 5.0.0.beta2中使用ActionCable时,应用程序存在服务器问题。使用localhost:3000可以正常工作,因为这是ActionCable的大多数默认设置。但是,如果我尝试在端口3001上运行rails服务器,它会给我返回“Request origin not allowed: http://localhost:3001”错误提示。 ActionCable文档提到可以使用类似“ActionCable.server.config.allowed_request_origins = ['http://localhost:3001']”这样的内容,将其放置在config.ru文件中可以解决问题,但这似乎不太合适。因为像这样的设置应该放在initializer文件或development.rb环境配置文件中,而且在development.rb中包含“ActionCable.server.config.disable_request_forgery_protection=true”目前有效,但“ActionCable.server.config.allowed_request_origins”无效。虽然有一些替代方案,但我仍想知道是否我对它的工作原理有所遗漏。