Skip to content

Commit e135055

Browse files
authored
Merge pull request #749 from JanHolger/fix-panic-without-mtls
Fix panic when mtls is disabled
2 parents 3714065 + 34ef9fa commit e135055

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/server/tunnel.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (t *Tunnel) ServeHTTP(w http.ResponseWriter, r *http.Request) {
4040
defer metrics.Metrics.HTTPConnectionDec()
4141

4242
klog.V(2).InfoS("Received request for host", "method", r.Method, "host", r.Host, "userAgent", r.UserAgent())
43-
if r.TLS != nil {
43+
if r.TLS != nil && len(r.TLS.PeerCertificates) > 0 {
4444
klog.V(2).InfoS("TLS", "commonName", r.TLS.PeerCertificates[0].Subject.CommonName)
4545
}
4646
if r.Method != http.MethodConnect {

0 commit comments

Comments
 (0)