diff --git a/pkg/server/tunnel.go b/pkg/server/tunnel.go index 3d3ec18d2..1f25b3169 100644 --- a/pkg/server/tunnel.go +++ b/pkg/server/tunnel.go @@ -40,7 +40,7 @@ func (t *Tunnel) ServeHTTP(w http.ResponseWriter, r *http.Request) { defer metrics.Metrics.HTTPConnectionDec() klog.V(2).InfoS("Received request for host", "method", r.Method, "host", r.Host, "userAgent", r.UserAgent()) - if r.TLS != nil { + if r.TLS != nil && len(r.TLS.PeerCertificates) > 0 { klog.V(2).InfoS("TLS", "commonName", r.TLS.PeerCertificates[0].Subject.CommonName) } if r.Method != http.MethodConnect {