简体   繁体   English

反向代理是否有可能将 http/1.1 连接升级到 http2?

[英]Is it possible that a reverse proxy upgrades a http/1.1 connection to http2?

Not really sure whether is possible or not, but if you have a reverse proxy for HTTP/1.1 connections, would it be possible to ugprade from the reverse proxy, said connections to HTTP/2, if the destination is capable of serving HTTP/2?不确定是否可行,但是如果您有用于 HTTP/1.1 连接的反向代理,是否可以从反向代理升级,即连接到 HTTP/2,如果目标能够提供 HTTP/2 ?

If it helps, the proxy is written in go, and it makes use of the reverseproxy package.如果有帮助,代理是用 go 编写的,它使用反向代理 package

Yes it's entirely possible.是的,这完全有可能。

Many web proxies (most?) are HTTP proxies (also called level 7 proxies) and have two, separate, HTTP connections - one for the incoming “frontend” and the other for the outgoing “backend”.许多 web 代理(大多数?)是 HTTP 代理(也称为 7 级代理),并且有两个独立的 HTTP 连接用于其他“前端”和“传出”连接。 These two connections can have completely different settings - including supporting different HTTP versions.这两个连接可以有完全不同的设置——包括支持不同的 HTTP 版本。

Other proxies are TCP proxies (also called level 4 proxies) and they have no concept of HTTP and just forward the TCP packets on and assume the otherwise will know what to do with them.其他代理是 TCP 代理(也称为 4 级代理),它们没有 HTTP 的概念,只需转发 TCP 数据包就知道如何处理它们。 In this case it is not possible To have different HTTP versions.在这种情况下,不可能有不同的 HTTP 版本。

Saying that, most of the benefit of HTTP/2 is for the front end connection as HTTP/2 improves the performance impact of HTTP over high latency connections.也就是说, HTTP/2 的大部分好处在于前端连接,因为 HTTP/2 提高了 HTTP 对高延迟连接的性能影响。 Typically backend connections are over lower latency, higher bandwidth connections (maybe even in the same data centre).通常后端连接通过更低延迟、更高带宽的连接(甚至可能在同一个数据中心)。 So while what you are asking is entirely possible whether you want to do this is more questionable.因此,尽管您要问的问题完全有可能,但您是否要这样做更值得怀疑。 And it's probably because of that questionable benefit that many servers don't actually support backend connections over HTTP/2.这可能是因为许多服务器实际上不支持通过 HTTP/2 的后端连接的可疑好处。 Apache does but has it marked as experimental . Apache 有,但将其标记为实验性的。 Nginx does not and say they won't . Nginx 没有并且说他们不会 I'm not familiar with Go but looks like it might support this .我不熟悉 Go但看起来它可能支持这个

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM