Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] How to catch HTTP2 "101 switching protocol" messages ?

Hello Simone;

The protocol between our LB and jetty based http agent is a binary proprietary protocol (I can't provide here the exact binary content), and we can't use the jetty PROXY protocol between our LB and the http agents.

So, let me explain better our need: when an http agent sends a HTTP2 101 protocol switch to the LB, we need to send the "special message" to the LB (before the HTTP2 101). This "special message"  is part of the proprietary protocol between the LB and the http agent, and is really similar to the 101 protocol switch: it just tells to the LB that a protocol switch will take place. We have to do this because the LB does not currently parse the real HTTP2 101 responded by jetty from the http agent.

There is actually a similar scenario when using Jetty Web Sockets: when a web socket client sends an initial request with some upgrade informations, then the jetty running inside the http agent sends a 101 http response in order to announce the switch to the Web Sockets protocol.
So, here we have the same need and we want to send the "special message" to the LB before the 101 is sent.
To do so, we are using the following trick which works for Web Sockets: we are attaching a RequestLogHandler to the org.eclipse.jetty.server.Server object (inside the http agent jvm), and when the 101 is about to be sent to the LB, our RequestLogHandler is first called and at this exact point, we are then sending the "special message" to the LB before the Web Socket 101 reponse is sent.

So, this does not seem to work in the context of HTTP2, and our RequestLogHandler is not called with the HTTP2 101 response. Is this something that is just impossible to do using HTTP2 ?  If not, then we'll have to consider some other approach.

thanks for your patience ...


On Mon, Sep 7, 2015 at 8:50 AM, Simone Bordet <sbordet@xxxxxxxxxxx> wrote:

On Sun, Sep 6, 2015 at 11:20 PM, Pierre De Rop <pierre.derop@xxxxxxxxx> wrote:
> Hi Simone;
> We are using a special protocol between our load balancer and our jetty
> based http agent. And the http agent needs to send a special message to the
> LB before the 101 is sent to it.

Can you explain in more details how this would work ?
E.g. with a graph and actual bytes that travel over the network ?

If "special message" is the PROXY protocol, then Jetty supports it out
of the box.

If it is something else, then perhaps you need an approach similar to
the PROXY protocol implementation: write your own ConnectionFactory
for both client and server, etc.

Simone Bordet
Developer advice, training, services and support
from the Jetty & CometD experts.
jetty-users mailing list
To change your delivery options, retrieve your password, or unsubscribe from this list, visit

Back to the top