title: rails 5, NGINX Error during WebSocket handshake: Unexpected response code: 404
body: <p>I try to deploy an simple web chat to server (nginx/puma). But I receive error console of browser: </p>
  
  <pre><code>WebSocket connection to 'ws://domain.com/cable' failed: Error during WebSocket handshake: Unexpected response code: 404
  </code></pre>
  
  <p>My config server domain.conf: </p>
  
  <pre><code>upstream backend {
    server unix:///var/run/backend.sock;
  }
  
  server {
    listen 80 ;
    server_name domain.com;
  
    root /home/rails/backend/public;
    access_log /home/rails/backend/log/nginx.access.log;
    error_log /home/rails/backend/log/nginx.error.log info;
  
    try_files $uri/index.html $uri @backend;
    location @backend {
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_redirect off;
  
      proxy_pass http://backend;
    }
  
    location ^~ /assets/ {
      gzip_static on;
      expires max;
      add_header Cache-Control public;
    }
  
    location /cable {
          proxy_pass http://gifty;
          proxy_http_version 1.1;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "upgrade";
        }
  }
  </code></pre>
  
  <p>Is it wrong some where? AnyOne setup it before. Please help me work out it</p>