Websocket's better support

jonathan.huot at thomsonreuters.com jonathan.huot at thomsonreuters.com
Thu Apr 20 09:57:01 CEST 2017

Hi Varnish dev & users,

Websocket is (still) not dying, and for us, it seems we have to handle more and more this kind of traffic.
It's why I would like to open a discussion and see how we can enhance the websocket support in Varnish.

Currently, the implementation is done thru pipe like this :

cli (Upgrade) -> recv -> pipe <--> backend

So basically, we're putting the ball into backend's hands and nothing else.
It has several disadvantages; one of them is that we cannot interact with the handshake's response which is still in HTTP/1.1.
E.g. adding a set-cookie for stickiness is not possible.
E.g. testing if status code is 101 is not possible

So, first problem, first question: do you think it is possible to allow opening the pipe after vcl_backend_response ?
The flow will be:

cli (Upgrade) -> recv -> pass -> b_fetch -> b_response -> pipe <---> backend

Only this extra step would be a huge improvement of what we can do on websockets connections and will be very beneficial.

Then, a bonus question, cuz it requires probably much more time:
I was wondering if later, websocket protocol can be integrated to the core (e.g. similarly to HTTP2?), to have benefits of metrics, params and logs.
Because, No, websocket messages are not just "bytes thru a pipe" :-)

Thanks for your answers,

Jonathan Huot
Thomson Reuters


This e-mail is for the sole use of the intended recipient and contains information that may be privileged and/or confidential. If you are not an intended recipient, please notify the sender by return e-mail and delete this e-mail and any attachments. Certain required legal entity disclosures can be accessed on our website.<http://site.thomsonreuters.com/site/disclosures/>

More information about the varnish-misc mailing list