Always I am indebted.

I'm trying to create a chat function using Action Cable on EC2 on AWS.
I am connecting via HTTPS using a load balancer.

Amazon Linux release 2 (Karoo)
Rails 5.2.3
Ruby version: 2.6.1
Load balancer

First of all, when I looked at the console of the browser, I got the following error.
failed: Error during WebSocket handshake: Unexpected response code: 404

This error occurred both when connecting with https and when connecting with http, but when nginx is stopped and connected on port 3000 without going through the load balancer, it disappears and it becomes possible to perform the intended movement using Action Cable. I will.

Refer to the following site, replace http part with https, but another error continues to appear.

failed: WebSocket is closed before the connection is established.

The color of the error has changed from red to yellow, but the Action Cable isn't working.
In this case as well, HTTPS/HTTP does not connect, and it works only on port 3000.

How should I run ActionCable under https environment?

It doesn't matter if it is a reference site, so I would appreciate it if you could teach me the appropriate method.

  • Answer # 1

    Since there was a problem with the content of the question, I would like to close it once, organize it, and then ask another question.