Ssl – Cannot establish Websocket on AWS

amazon-web-servicesload balancingsslwebsocket

I have a webserver running on an EC2 instance behind an AWS load balancer under a custom domain for using https.

Curl requests to the webserver work as expected, including over https. But establishing a websocket connection fails with the following error (in Chrome):

WebSocket connection to 'wss://sub.foo.com/' failed: Unknown reason

While this is a cryptic error message, my guess is that this has to do with AWS, because:

  • Establishing the socket with the server running on localhost works fine
  • Establishing the socket with the server running on AWS by bypassing the load balancer works fine

I use Clojure's http-kit for the webserver, but suspect it doesn't matter.

Amazon says its load balancers support websockets, so what am I doing wrong?

Best Answer

This ended up being something completely unrelated: a browser extension. The uBlock Origin browser extension seems to not like secure websocket connections being made across domains (in this case, from localhost to my server on AWS behind my custom domain as I was testing).

Related Topic