Action Cable on HTTPS error during WebSocket handshake: Unexpected response code: 404

466 views Asked by At

It works fine with http, but when upgrade to https this error happen.

Here is my environments:

  • AWS Elastic Beanstalk
  • 64bit Amazon Linux 2016.09 v2.2.0 running Ruby 2.3 (Puma)
  • ActionCable

Configurations:

    location /cable {
            proxy_pass http://my_app;
            proxy_http_version 1.1;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "Upgrade";
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $http_host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-Proto https;
          }

Log from server:

    [2016-12-18T13:07:48.252727 #19764]  INFO -- : [4d1c9c93-2724-48c6-8b7c-4e42beae94c7] Started GET "/cable" for 162.158.166.199 at 2016-12-18 13:07:48 +0000    
    [2016-12-18T13:07:48.254025 #19764]  INFO -- : [4d1c9c93-2724-48c6-8b7c-4e42beae94c7] Started GET "/cable/"[non-WebSocket] for 162.158.166.199 at 2016-12-18 13:07:48 +0000
    [2016-12-18T13:07:48.254084 #19764] ERROR -- : [4d1c9c93-2724-48c6-8b7c-4e42beae94c7] Failed to upgrade to WebSocket (REQUEST_METHOD: GET, HTTP_CONNECTION: Upgrade, HTTP_UPGRADE: )
    [2016-12-18T13:07:48.254146 #19764]  INFO -- : [4d1c9c93-2724-48c6-8b7c-4e42beae94c7] Finished "/cable/"[non-WebSocket] for 162.158.166.199 at 2016-12-18 13:07:48 +0000

I really appreciate your help.

Thanks.

0

There are 0 answers