From ab7252831eebd157c09809d3fe2ac2f78f4b3d9a Mon Sep 17 00:00:00 2001 From: Nitish Tiwari Date: Sat, 13 Apr 2019 10:59:12 +0530 Subject: [PATCH] Fix healthcheck script to check for BadRequest Status (#7537) As a part of #7302, MinIO server's (configured with https) response when it encounters http request has changed from 403 to 400 and the custom message "SSL Required" is removed. Accordingly healthcheck script is updated to check for status 400 before trying https request. Fixes #7517 --- dockerscripts/healthcheck.go | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/dockerscripts/healthcheck.go b/dockerscripts/healthcheck.go index c7a7b0f4a..019215dde 100755 --- a/dockerscripts/healthcheck.go +++ b/dockerscripts/healthcheck.go @@ -21,7 +21,6 @@ import ( "crypto/tls" "errors" "fmt" - "io/ioutil" "log" "net/http" "net/url" @@ -142,18 +141,10 @@ func main() { // exit with success os.Exit(0) } - bodyBytes, err := ioutil.ReadAll(resp.Body) - if err != nil { - // Drain any response. - xhttp.DrainBody(resp.Body) - // GET failed exit - log.Fatalln(err) - } - bodyString := string(bodyBytes) // Drain any response. xhttp.DrainBody(resp.Body) - // This means sever is configured with https - if resp.StatusCode == http.StatusForbidden && bodyString == "SSL required" { + // 400 response may mean sever is configured with https + if resp.StatusCode == http.StatusBadRequest { // Try with https u.Scheme = "https" resp, err = client.Get(u.String())