HTTP2 proxy

95 views
Skip to first unread message

Brad Wood

unread,
Mar 26, 2021, 4:13:02 PM3/26/21
to Undertow Dev
Moving a conversation here to this group.  Here is the original post followed by some questions that were in progress.

-----------------------

I'm working on some HTTP2 support and I'm curious if anyone can explain what exactly the proxy does in all the undertow examples out there.  They all seem to do the same thing, but don't really have any comments explaining why they're doing it.   Is there a reason HTTP2 can't just be enabled on the normal HTTP/HTTPS listeners?

From what I can tell, all the HTTP2 examples show a second undertow server being started on a different port as a reverse proxy that proxies back to the original port..  And the original port sets up a redirect over to the proxy port.  The code makes sense in what it's doing, but not why.

Also, every Undertow example seems to set a x-undertow-transport header.  This header isn't in the main Undertow source code, just the examples but it seems to have worked its way into JBOSS EAP leading some people to believe it's a guaranteed thing to exist.  Can anyone explain the purpose of this header other than debugging?

---------------------

You mean this one: https://github.com/undertow-io/undertow/blob/b5e4969a7486a06f060e1eef47ff3c0b7d088788/examples/src/main/java/io/undertow/examples/http2/Http2Server.java#L77 

Correct.  I was asking if simply including that option was enough to enable HTTP2.

The proxy was added to be able to demonstrate server push through the reverse proxy, its not an essential part.

Interesting.  So is the reverse proxy even related to the HTTP2 example, or is it just something random in the example?  It seems that every other HTTP2 example I've been able to find online for undertow has this reverse proxy in place as though it's somehow required.  Should it be removed from the example or does it still somehow serve a useful purpose in serving HTTP2?

This was added to the example back went http/2 was new, so you could see if it was working.

Good to know.

 Are you sure it is in EAP? If it is this is a bug,

I didn't test EAP directly, but I did find references to it on blog posts like this one which use Javascript code to check for the existence of that header on a JBoss EAP server.


the only example of it I can see in either code base is in that one example.

Yes, there are VERY few examples online that show how to use HTTP2 with undertow and none of them come with any documentation for explanation.

So just to confirm very specifically-- you are saying I don't need the reverse proxy listening on another port?  I can simply activate the HTTP2 option on my existing HTTP listener/port and that's all?

Thanks again for the help!

Flavia Rainone

unread,
Mar 26, 2021, 5:01:42 PM3/26/21
to Undertow Dev
Hi Brad!

You are right, the reverse proxy is just related to the example. It was added as an improvement via this commit: https://github.com/undertow-io/undertow/commit/535cfdaf367a9ebe8437bc42391c42cf24ae6841

I think we can split the example in two, just so we don't remove that from the examples but making it clearer that enabling HTTP2 via UndertowOption is the sole step required from the server pov to enable HTTP2.

When you look at the code, you will see that, when this option is used, the Http2 related listeners are used:
https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/Undertow.java#L180

I think I will also add an improvement to the community documentation as well.

I created a Jira for this improvement in HTTP2: https://issues.redhat.com/browse/UNDERTOW-1871

Regards,
Flavia
Reply all
Reply to author
Forward
0 new messages