From 978a8a83f019ad369e18c063685001709dbde601 Mon Sep 17 00:00:00 2001 From: Johan Fleury Date: Fri, 8 Oct 2021 11:34:05 -0400 Subject: [PATCH] Add support for setting server_name as query parameter --- ssl_exporter.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/ssl_exporter.go b/ssl_exporter.go index 2051c536..6a30b680 100644 --- a/ssl_exporter.go +++ b/ssl_exporter.go @@ -35,6 +35,12 @@ func probeHandler(logger log.Logger, w http.ResponseWriter, r *http.Request, con return } + if serverName := r.URL.Query().Get("server_name"); serverName != "" { + level.Debug(logger).Log("msg", fmt.Sprintf("Using %s as server name", serverName)) + logger = log.With(logger, "server_name", serverName) + module.TLSConfig.ServerName = serverName + } + timeout := module.Timeout if timeout == 0 { // The following timeout block was taken wholly from the blackbox exporter