I tried it on a couple versions of Ruby and OpenSSL, the newest being Ruby 3.2.2 and OpenSSL 3.1.0.
The original reason for diving into this was trying to get Faye::WebSocket::Client to connect, but it was being closed immediately without an error. I think this is the root cause, but I’m at my wit’s end. Thanks in advance for any suggestions or debugging tips.
So I did find the fix for this particular problem. The solution was setting
ssl_socket.hostname = host
before connecting. This sets the “SNI hostname” extension, which I am guessing is required for Fly to figure out which certificate to serve up on a given IP endpoint.
Unfortunately, I dug into the source for faye-websocket and eventmachine, and the SNI hostname is correctly populated by these libraries. So I am back to square one, trying to figure out why the WebSocket client won’t connect. That’s a separate issue from my original question, so I may open a new thread for that.
It turns out the faye-websocket gem needed to be upgraded to v0.11.3 to pull in changes that set the SNI hostname correctly. After the upgrade, the WebSocket client connects up to Fly just fine.