File pr-3174.patch of Package golang-github-prometheus-prometheus

diff -ruN -x '*~' -x '*.o' -x '*.a' -x '*.so' -x '*.so.[0-9]' -x autom4te.cache -x .deps -x .libs ../orig-prometheus-2.1.0/web/web.go ./web/web.go
--- ../orig-prometheus-2.1.0/web/web.go	2018-01-19 12:54:28.000000000 +0100
+++ ./web/web.go	2018-01-25 12:11:59.152359023 +0100
@@ -414,7 +414,21 @@
 	)
 	av2.RegisterGRPC(grpcSrv)
 
-	hh, err := av2.HTTPHandler(h.options.ListenAddress)
+	lAddr := h.options.ListenAddress
+	host, port, err := net.SplitHostPort(lAddr)
+	if err != nil {
+		return err
+	}
+	ip := net.ParseIP(host)
+	if ip.Equal(net.IPv4zero) || ip.Equal(net.IPv6zero) {
+		// The gRPC server is listening on an empty/wildcard address (0.0.0.0 or ::).
+		// We should be able to connect to an empty IP just fine, but as there were
+		// some issues with this in the past (#3004, #3149), we explicitly tell
+		// the REST API gateway to connect to localhost.
+		lAddr = net.JoinHostPort("localhost", port)
+	}
+
+	hh, err := av2.HTTPHandler(lAddr)
 	if err != nil {
 		return err
 	}
openSUSE Build Service is sponsored by