Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ActionCable in production repeated 101 responses

I'm attempting to deploy a standalone ActionCable server for our rails app. The app is working locally in development mode fine but when deployed to production the client is unable to establish a connection. The problem manifests as the following:

enter image description here

These are repeated 101 Switching Protocol requests with an upgrade response. The requests never go further than this and repeat at roughly six second intervals. On the server I'm running Puma and I can see the incoming requests:

enter image description here

I've ensured I'm sharing cookies between the main domain and the subdomain (and can see the cookies being passed) but I never see the connection get upgraded.

Some notes:

  • The connection is not over SSL
  • I've tested that our corporate firewall is not blocking WebSockets
  • The cable server is being hosted on a GCP Cloud Compute instance
  • Action cable is being run using Puma
  • I can see some outgoing frames sent on the second WebSocket request but no incoming frames.

I'm out of ideas so would appreciate some thoughts on what I could try next to debug this!

like image 203
Samuel Avatar asked Oct 16 '25 10:10

Samuel


1 Answers

So I eventually got to the bottom of this. For those following in my footsteps it was an issue around cookie name-spacing. Essentially the cookies were not being set the domain level so therefore were not being shared with the cable server (which was on a subdomain).

If you're suffering a similar issue try running the cable server in development mode while the app runs in production - the additional log output should make it easier to figure out what is going on.

like image 84
Samuel Avatar answered Oct 19 '25 00:10

Samuel



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!