WSS request not being upgraded via Nginx

Olivier Keun olivier.keun at
Sat Dec 22 12:40:33 UTC 2018

I'm attempting to upgrade a WSS request on Varnish 4 via Nginx.

sub vcl_recv {
  if (req.http.Upgrade ~ "(?i)websocket") {
    return (pipe);

sub vcl_pipe {
  if (req.http.upgrade) {
    set bereq.http.upgrade = req.http.upgrade;

server {
  listen      8080 default_server;

  location /socket {
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection "Upgrade";

When initiating a WSS connection the request fails with "426 Upgrade header
MUST be provided", although the header is provided by the client.

When forcing the Upgrade header in Nginx:

proxy_set_header Upgrade "websocket";

The request passes to the backend and produces a new connection, the client
however does not receive a response back and times out.

Is there anything i can do to debug this further?

Thank you and regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the varnish-misc mailing list