title: RoR 5.0.0 ActionCable wss WebSocket handshake: Unexpected response code: 301
body: <p>Hello I'm trying to serve a simple chat using ror 5.0.0 beta (with puma)
  working on production mode (in localhost there are no problems).</p>
  
  <p>This is my <strong>Nginx</strong> configuration:</p>
  
  <pre><code>upstream websocket {
      server 127.0.0.1:28080;
  }
  
  
  server {
  
      listen 443;
      server_name mydomain;
      ssl_certificate ***/server.crt;
      ssl_certificate_key ***/server.key;
      ssl on;
      ssl_session_cache builtin:1000 shared:SSL:10m;
      ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      ssl_ciphers 
  HIGH:!aNULL:!eNULL:!EXPORT:!CAMELLIA:!DES:!MD5:!PSK:!RC4;
      ssl_prefer_server_ciphers on;
      access_log /var/log/nginx/jenkins.access.log;
  
      location / {
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_pass http://localhost:3000;
        proxy_read_timeout 90;
  
        proxy_redirect http://localhost:3000 https://mydomain;
  
  
      location /cable/{
          proxy_pass         http://websocket/;
          proxy_http_version 1.1;
          proxy_set_header   Upgrade $http_upgrade;
          proxy_set_header   Connection "upgrade";
          proxy_set_header   Host $http_host;
          break;
      }
  
     }
  </code></pre>
  
  <p>This is <strong>config/redis/cable.yml</strong></p>
  
  <p>production:
      url: redis://localhost:6379/1</p>
  
  <p>development:
      url: redis://localhost:6379/2</p>
  
  <p>test:
      url: redis://localhost:6379/3</p>
  
  <p>and <strong>config/environments/production.rb</strong></p>
  
  <pre><code>  # Action Cable endpoint configuration
    config.action_cable.url = 'wss://mydomain/cable'
    # config.action_cable.allowed_request_origins = [ 'http://example.com', /http:\/\/example.*/ ]
  
    # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
    config.force_ssl = false
  </code></pre>
  
  <p>And this is the error i'm receiving:</p>
  
  <p>application-[...].js:27 WebSocket connection to 'wss://mydomain/cable' failed: Error during WebSocket handshake: Unexpected response code: 301</p>
  
  <p>Any tips? :) Thanks</p>