Golang存储库的概念HTTP/HTTP问题

发布于 2025-01-22 23:29:18 字数 529 浏览 2 评论 0 原文

我有一个使用Golang构建的网关API。我们使用此处记录的“ net/http”库。该服务具有HTTPS连接设置。与我的ELB使用HTTP的连接是因为我使用TLS终止。因此,这个One Gateway API具有SSL证书。但是然后将连接传递到常规HTTP连接到其他实例。

简而言之,网关API具有HTTPS支持,但是连接到我的网关API的服务使用HTTP。

当我检查UI服务时,它表明我们仍在使用HTTP 1.1。但是,从Golang的文档中,软件包“ NET/HTTP”应自动提供HTTP 2.0支持。

我是否需要升级内部服务以使用HTTP而不是HTTP才能使用HTTP 2.0?

抱歉,如果这篇文章脱颖而出或粗鲁。我非常感谢任何人花时间阅读此书,并愿意提供更多所需的信息。

I have a Gateway API that is built with Golang. We use the "net/http" library documented here https://pkg.go.dev/net/http#example-ListenAndServeTLS. This service has HTTPS connection set up. The connections to my ELB’s use HTTPS because I use TLS termination. So this one Gateway API has the ssl cert. But then passes the connection to a regular HTTP connection to the other instances.

In short, the Gateway API has HTTPs support, but the services connected to my Gateway API uses HTTP.

When I check my UI services, It shows that we are using HTTP 1.1 still. However from Golang's documentation the package "net/http" should provide HTTP 2.0 support automatically.

Do I need to upgrade my internal services to use HTTPs instead of HTTP in order to use http 2.0?

Sorry If this post comes off as ignorant or rude. I really appreciate anyone taking there time to read this, and am willing to provide any more information that Is needed.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

温柔嚣张 2025-01-29 23:29:18

HTTP2包括H2(TLS)H2C(无TLS),NET/HTTP使用H2默认值 listeandservetls

如果使用http,则NET/http不使用H2C,而是http1.1

exase net/http不支持H2C默认值,如果您想使用H2C(http/2的非TLS版本):

http2 include h2(TLS) h2c(no TLS), net/http use h2 default when ListenAndServeTLS.

if you use http, net/http not use h2c, but http1.1 currently no browser supports HTTP/2 unencrypted

becase net/http don't support h2c default, if you want use h2c(non-TLS version of HTTP/2):

https://pkg.go.dev/golang.org/x/[email protected]/http2/h2c

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文