Getting Bad request 400 with reverse proxy NGINX with web socket channels

Just found out that the exact missing setting was to force http 1.1 (i’m just testing without ssl for now): “proxy_http_version 1.1”.

as in:

location / {
          proxy_http_version 1.1; # <------------------------------
          proxy_pass http://localhost:some-port-here;
          proxy_set_header Upgrade $http_upgrade;
          proxy_set_header Connection "Upgrade";
          proxy_set_header        X-Forwarded-For   $remote_addr;
          proxy_set_header        X-Real-IP         $remote_addr;
          proxy_set_header        Host              $host;
          proxy_set_header Access-Control-Allow-Origin *;
          proxy_read_timeout 900;
      }