简体   繁体   English

Rails Heroku Cloudflare SSL和websockets

[英]Rails Heroku Cloudflare SSL and websockets

I have set up my Rails app on Heroku and used the information in the post: Heroku + Cloudflare completely free SSL to get SSL working for free, but my websockets connection does not work. 我已经在Heroku上设置了我的Rails应用程序,并使用了以下信息: Heroku + Cloudflare完全免费的SSL使SSL免费运行,但是我的websockets连接不起作用。 I get the error WebSocket connection to 'wss://www.myapp.com/websocket' failed: Error during WebSocket handshake: Unexpected response code: 200 . 我收到错误的WebSocket connection to 'wss://www.myapp.com/websocket' failed: Error during WebSocket handshake: Unexpected response code: 200 I understand that this is due to Cloudflare not supporting websockets in their free plans and they suggest setting up a subdomain that does not pass through Cloudflare. 我了解这是由于Cloudflare在其免费计划中不支持websocket,他们建议设置不通过Cloudflare的子域。 The problem of course is that the subdomain cannot then use the 'free' SSL setup. 当然,问题在于子域无法再使用“免费” SSL设置。

Is there anyway I can get this to work, or do I have to shell out for either SSL support on Heroku or Websocket support on Cloudflare? 无论如何,我可以使它正常工作吗?还是我必须为Heroku上的SSL支持或Cloudflare上的Websocket支持掏腰包?

I know this is an old thread. 我知道这是一个旧线程。

But now cloudflare supports websocket for free plan as well. 但是现在cloudflare也支持免费计划的websocket。 It just restricts the ports which can be used. 它只是限制了可以使用的端口。

I recently encountered this situation and could implement the websockets through cloudflare . 我最近遇到了这种情况,可以通过cloudflare实现websocket Can refer my approach here 可以在这里参考我的方法

May help someone. 可以帮助某人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM