How should the actioncable url under the docker be set?

What should an action url specify when using Rails with Actioncable in Docker?

Usually it's something like

config.action_cable.url = "ws://localhost:3000/cable"

But that does not work. I tried a few permutations, but all I get is

Started GET "/cable" for 172.18.0.6 at 2016-11-22 17:49:37 +0000
Started GET "/cable/"[non-WebSocket] for 172.18.0.6 at 2016-11-22 17:49:37 +0000
Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: close, HTTP_UPGRADE: )
Finished "/cable/"[non-WebSocket] for 172.18.0.6 at 2016-11-22 17:49:37 +0000

My docker-compose.yml file is here . I tried using a separate cable image (commented out) without any luck. I don’t understand yet, the application image and the cable image seem to be in conflict, and one or both instances of puma just restart. Fixing this will be a bonus.

+4
source share
1 answer

actioncable , :

config.action_cable.url = "ws://localhost:28080"
config.action_cable.allowed_request_origins = %r{http://localhost.*}
+1

Source: https://habr.com/ru/post/1661620/


All Articles