mirror of https://github.com/minio/minio.git
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
This commit is contained in:
parent
35ef5eb236
commit
ab7252831e
|
@ -21,7 +21,6 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
@ -142,18 +141,10 @@ func main() {
|
||||||
// exit with success
|
// exit with success
|
||||||
os.Exit(0)
|
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.
|
// Drain any response.
|
||||||
xhttp.DrainBody(resp.Body)
|
xhttp.DrainBody(resp.Body)
|
||||||
// This means sever is configured with https
|
// 400 response may mean sever is configured with https
|
||||||
if resp.StatusCode == http.StatusForbidden && bodyString == "SSL required" {
|
if resp.StatusCode == http.StatusBadRequest {
|
||||||
// Try with https
|
// Try with https
|
||||||
u.Scheme = "https"
|
u.Scheme = "https"
|
||||||
resp, err = client.Get(u.String())
|
resp, err = client.Get(u.String())
|
||||||
|
|
Loading…
Reference in New Issue