Skip to content

Commit aa61917

Browse files
authored
Remove TLS EOF errors from logs (#16930)
Signed-off-by: Manuel de Brito Fontes <[email protected]>
1 parent b1ab625 commit aa61917

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

components/ws-proxy/pkg/proxy/proxy.go

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,18 @@
55
package proxy
66

77
import (
8+
"bytes"
89
"crypto/tls"
10+
stdlog "log"
911
"net/http"
1012
"os"
1113
"path/filepath"
1214

13-
"github.com/gitpod-io/golang-crypto/ssh"
1415
"github.com/gorilla/mux"
1516
"github.com/klauspost/cpuid/v2"
1617

1718
"github.com/gitpod-io/gitpod/common-go/log"
19+
"github.com/gitpod-io/golang-crypto/ssh"
1820
)
1921

2022
// WorkspaceProxy is the entity which forwards all inbound requests to the relevant workspace pods.
@@ -64,6 +66,7 @@ func (p *WorkspaceProxy) MustServe() {
6466
PreferServerCipherSuites: true,
6567
NextProtos: []string{"h2", "http/1.1"},
6668
},
69+
ErrorLog: stdlog.New(logrusErrorWriter{}, "", 0),
6770
}
6871

6972
var (
@@ -141,3 +144,16 @@ func optimalDefaultCipherSuites() []uint16 {
141144
}
142145
return defaultCipherSuitesWithoutAESNI
143146
}
147+
148+
var tlsHandshakeErrorPrefix = []byte("http: TLS handshake error")
149+
150+
type logrusErrorWriter struct{}
151+
152+
func (w logrusErrorWriter) Write(p []byte) (int, error) {
153+
if bytes.Contains(p, tlsHandshakeErrorPrefix) {
154+
return len(p), nil
155+
}
156+
157+
log.Errorf("%s", string(p))
158+
return len(p), nil
159+
}

0 commit comments

Comments
 (0)