Proxy websocket requests with nginx

upstream nodews {
    server 127.0.0.1:8546;
    keepalive 120;
}

server {
   server_name domain.tld;
...
    location '/ws/' {
        proxy_pass http://nodews/;
        proxy_http_version 1.1;
        proxy_redirect off;
        proxy_buffering off;

        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header Host "domain.tld";
    }
...
}