Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Proxy from H2 to 1.1

On Fri, Jul 31, 2020 at 9:52 AM Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
>
> Hi,

Hello again!

> On Thu, Jul 30, 2020 at 5:54 PM Travis Spencer <travis.spencer@xxxxxxxxx> wrote:
> >
> > On Thu, Jul 30, 2020 at 4:33 PM Simone Bordet <sbordet@xxxxxxxxxxx> wrote:
> > > On Thu, Jul 30, 2020 at 11:47 AM Travis Spencer
> > > <travis.spencer@xxxxxxxxx> wrote:
> > > > HttpRequest[GET /some-other-good-api HTTP/2.0]@8c22593
> >
> > See, Simone, how the proxy uses H2 as well and not 1.1?
>
> That does not mean the request is sent using HTTP/2.
> The HTTP version is copied from the incoming request, which in your
> case is HTTP/2.
> But it is sent as HTTP/1.1 on the wire and that may confuse your server.

Ah, I see what you mean. Only the request line was saying it was 2.0
but the message itself was encoded as 1.1. Got it!

> Override AsyncProxyServlet.copyRequestHeaders() or addProxyHeaders()
> to customize the proxy request, and force
> version(HttpVersion.HTTP_1_1).

Ya, that fixed the issue.

> Please file an issue about this, we should do a bit better here.

https://github.com/eclipse/jetty.project/issues/5103

> > Here's an example of the default Via that's created when my subclass calls org.eclipse.jetty.proxy.AbstractProxyServlet#addProxyHeaders:
> >
> > Via: http/1.1 null
> >
> > The http/1.1 is hardcoded (which is wrong IINM, since I connected via H2) and the host is not a pseudonym and not the actual host.
>
> I don't know where this comes from.

We don't use this as a servlet, so init was never being called. I
fixed this on our side since we're using it in an unorthodox manner.

> The "http/1.1" is hardcoded in addViaHeader(), but you can override the method.
>
> Please file an issue about this as well, as we should remove the
> hardcoded "http/1.1" from the Via header.

https://github.com/eclipse/jetty.project/issues/5104

Thanks, Simone, for all the help. I've got my proxy working now!

I will send in a couple PRs for the above issues. Happy to give back a
little for all you guys do!


Back to the top