Skip to content

Commit

Permalink
Fix healthcheck script to check for BadRequest Status (minio#7537)
Browse files Browse the repository at this point in the history
As a part of minio#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 minio#7517
  • Loading branch information
nitisht authored and kannappanr committed Apr 13, 2019
1 parent 35ef5eb commit ab72528
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions dockerscripts/healthcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import (
"crypto/tls"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
Expand Down Expand Up @@ -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())
Expand Down

0 comments on commit ab72528

Please sign in to comment.