What does HTTP/2 mean for a reverse proxy server?
Asked Answered
V

2

24

How HTTP/2 affects the implementation of a proxy server? Especially, for example, when a client sends an HTTP/2 request to a content server that only supports HTTP/1.x, should the proxy server tranform the HTTP/2 request to HTTP/1.x request before directing the client request to the content server? And upon receiving response from the content server, should the proxy server transform the response to the HTTP/2 format before sending it back to the client?

Vagabondage answered 7/4, 2016 at 8:47 Comment(0)
M
7

Yes, it is exactly as you say. Conversion from HTTP/2 to HTTP/1.1 must happen in one direction, and from HTTP/1.1 to HTTP/2 must happen in the other case.

In practice this means that although HTTP/2 the protocol doesn't need a traditional text-based parser, a comprehensive HTTP/2 server needs an HTTP/1.1 parser, not only to work with clients which are HTTP/1.1 only (among them crawlers) but also for talking to inner applications.

By use, one of the most important application protocols is FastCGI. FastCGI also requires parsing of HTTP/1.1 responses from the application and conversion to HTTP/2 responses to the client.

Monocyclic answered 7/4, 2016 at 10:5 Comment(3)
If this is the case, can I understand like this: a proxy server is more helpful than it used to be, since it also enables the communication between an HTTP/2 client and a content server that only supports HTTP/1.1 without upgrating the content server to HTTP/2?Vagabondage
Absolutely. I build one of such beasts, ShimmerCat .Monocyclic
can someone fix the link in the answerTiffaneytiffani
G
13

As dsign discussed, your understanding is correct.

However I thought it was worth pointing out there are still massive advantages to HTTP/2 at your edge connection (i.e. Your reverse proxy) as the issues HTTP/2 solves (primarily latency) are less of an issue over the typically shorter, typically high bandwidth hop from the reverse proxy to the content server.

For example if you have a 100ms delay to the reverse proxy at the edge and only 1ms delay between the reverse proxy and the content server, then the fact the content server is speaking HTTP/1.1 to the proxy server probably won't have much impact on performance due to the super fast 1ms latency. So the end client (speaking HTTP/2 to the reverse proxy) still sees a massive performance boast over HTTP/1.1.

Gothic answered 7/4, 2016 at 18:42 Comment(2)
Does the reverse proxy have to remember all the cookies in the h2 connection so that when it converts a request to http1 for a downstream application it can send the whole cookie load?Othilia
Are you meaning because of header compression under HTTP/2? If so this should happen yes - though that's automatically part of running a HTTP/2 server. Either the HTTP/2 connection is open (in which case the server needs to manage the header compression and be able to uncompressed it) or the connection is not open and the original request will need to send all the cookies in the first request and build up the header compression values.Gothic
M
7

Yes, it is exactly as you say. Conversion from HTTP/2 to HTTP/1.1 must happen in one direction, and from HTTP/1.1 to HTTP/2 must happen in the other case.

In practice this means that although HTTP/2 the protocol doesn't need a traditional text-based parser, a comprehensive HTTP/2 server needs an HTTP/1.1 parser, not only to work with clients which are HTTP/1.1 only (among them crawlers) but also for talking to inner applications.

By use, one of the most important application protocols is FastCGI. FastCGI also requires parsing of HTTP/1.1 responses from the application and conversion to HTTP/2 responses to the client.

Monocyclic answered 7/4, 2016 at 10:5 Comment(3)
If this is the case, can I understand like this: a proxy server is more helpful than it used to be, since it also enables the communication between an HTTP/2 client and a content server that only supports HTTP/1.1 without upgrating the content server to HTTP/2?Vagabondage
Absolutely. I build one of such beasts, ShimmerCat .Monocyclic
can someone fix the link in the answerTiffaneytiffani

© 2022 - 2024 — McMap. All rights reserved.