WSS request not being upgraded via Nginx

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


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

[varnish]
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;
  }
}

[nginx]
server {
  listen      8080 default_server;

  location /socket {
    proxy_pass http://127.0.0.1:8081;
    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,
Olivier
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20181222/4338bed9/attachment.html>


More information about the varnish-misc mailing list