WSS request not being upgraded via Nginx

Guillaume Quintard guillaume at varnish-software.com
Sat Dec 22 13:00:18 UTC 2018


Hi,

What's the purpose of nginx here? Can't you pipe directly to the backend
and skip nginx altogether?

Cheers,

-- 
Guillaume Quintard


On Sat, Dec 22, 2018 at 1:41 PM Olivier Keun <olivier.keun at gmail.com> wrote:

> 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
>
>
> _______________________________________________
> varnish-misc mailing list
> varnish-misc at varnish-cache.org
> https://www.varnish-cache.org/lists/mailman/listinfo/varnish-misc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.varnish-cache.org/lists/pipermail/varnish-misc/attachments/20181222/562bd8d7/attachment-0001.html>


More information about the varnish-misc mailing list