Ssl 如何使用Go on Heroku修复TLS握手错误?

Ssl 如何使用Go on Heroku修复TLS握手错误?,ssl,go,heroku,lets-encrypt,Ssl,Go,Heroku,Lets Encrypt,我有一个简单的代理,在同一个端口上侦听HTTP和HTTPS连接 然而,我发现奇怪的TLS握手错误似乎是由Heroku路由器引起的: heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=GET path="/favicon.ico" host=banana.camp request_id=f56144c8-e480-476a-90b8-429b490f1ff5 fwd="24

我有一个简单的代理,在同一个端口上侦听HTTP和HTTPS连接

然而,我发现奇怪的TLS握手错误似乎是由Heroku路由器引起的:

heroku[router]: sock=backend at=error code=H18 desc="Server Request Interrupted" method=GET path="/favicon.ico" host=banana.camp request_id=f56144c8-e480-476a-90b8-429b490f1ff5 fwd="24.67.185.77" dyno=web.1 connect=0ms service=1ms status=503 bytes=7 protocol=https
http: TLS handshake error from 10.81.159.108:19578: tls: first record does not look like a TLS handshake
http: TLS handshake error from 172.17.117.25:36924: EOF
有没有办法修复或忽略它们?任何线索都将不胜感激

谢谢

func InitServer()错误{
m:=自动插入管理器{
缓存:autocert.DirCache(*StorageDir),
提示:autocert.acceptos,
主机策略:func(ctx context.context,主机字符串)错误{
归零
},
}
errchan:=make(chan错误)
s:=&http.Server{
地址:“:”+os.Getenv(“端口”),
TLSConfig:&tls.Config{GetCertificate:m.GetCertificate},
处理程序:ServeHTTP(),
}
go(func(){

errchan您不能在同一端口上同时侦听http和https,并且当您的http客户端尝试连接到应用程序时,会出现这些日志错误。

默认情况下,golang http服务器只支持在给定端口上侦听http或https流量(不是两者都支持)。若要侦听https流量,您需要使用http.listendServeTls

如果您在仅为一个配置的点上同时定向http和https流量,则最终将看到错误


有第三方解决方案(如)支持在同一端口上承载安全和不安全流量。这不像分离端口那么简单,但如果您想这样做,它们在自述文件中有一个示例配置。

TLS终止由Heroku路由器处理,无法在应用程序级别完成'_(ツ)_/“

当我只听TLS时,我会遇到同样的错误。而且,HTTP侦听器在goroutine中,这应该可以解决问题,不是吗?