varnish (plus) http/2 and websockets, server sent events
Guillaume Quintard
guillaume.quintard at gmail.com
Fri Jun 20 09:37:02 UTC 2025
Hi Tom,
This is a base behavior, so Varnish Enterprise inherits it, but it's
present in Varnish Cache too.
Piping involves foregoing HTTP parsing and just passing all the connection
bytes back and forth. It's possible on HTTP 1.x since there's only at most
one request per connection, but this breaks with HTTP2 multiplexing, so
Varnish does the best thing it can and uses a pass instead.
Interestingly, H/2 didn't plan an upgrade path to websockets (or to
anything else, really) for a relatively sane reason: H/2 requires TLS and
TLS has ALPN that allows you to go to websockets directly, without the
upgrade hop.
So, to my (maybe outdated) knowledge of H/2, upgrading to websockets isn't
possible.
Please let me know if I'm not being clear.
--
Guillaume Quintard
On Fri, Jun 20, 2025, 11:15 Tom Anheyer | BerlinOnline <
Tom.Anheyer at berlinonline.de> wrote:
> Hello,
>
> I don't know if this is specific to varnish plus:
>
>
> If I enable pipe-mode for server sent events in vcl_recv this way:
>
> if (…) {
> set req.http.connection = "close";
> return(pipe);
> }
>
> the log shows:
>
> - VCL_return pipe
> - VCL_call HASH
> - VCL_return lookup
> - VCL_Error vcl_recv{} returns pipe/connect for HTTP/2 request.
> Doing pass.
> - VCL_call PASS
>
>
> Is it possible to use server sent events, websockets with http/2 requests?
>
>
> I've opened a varnish software ticket but I think that's public interest.
>
> tom
>
> --
> Tom Anheyer
> Senior Developer
>
> BerlinOnline GmbH
> Stefan-Heym-Platz 1
> 10367 Berlin
> Germany
>
> Tel.: +49-30-5771180-62
> Fax: +49 30 5771180-95
> E-Mail: tom.anheyer at berlinonline.de
>
> berlin.de | berlinonline.net
>
> Amtsgericht Berlin-Charlottenburg, HRB 266384
> Sitz der Gesellschaft: Berlin, Deutschland
> USt.-IdNr.: DE219483549
>
> Geschäftsführung: Andreas Mängel, Katrin Dorgeist
> Vorsitzender des Aufsichtsrats: Nicolas Zimmer
>
>
> _______________________________________________
> 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/20250620/4e98c32b/attachment.html>
More information about the varnish-misc
mailing list