|
|
|
@ -15,6 +15,8 @@ |
|
|
|
|
# limitations under the License. |
|
|
|
|
# |
|
|
|
|
|
|
|
|
|
set -x |
|
|
|
|
|
|
|
|
|
_init () { |
|
|
|
|
scheme="http://" |
|
|
|
|
address="127.0.0.1:9000" |
|
|
|
@ -32,11 +34,11 @@ healthcheck_main () { |
|
|
|
|
exit 0 |
|
|
|
|
else |
|
|
|
|
# Get the http response code |
|
|
|
|
http_response=$(curl -s -k -o /dev/null -I -w "%{http_code}" \ |
|
|
|
|
http_response=$(curl -H "User-Agent: Mozilla" -s -k -o /dev/null -I -w "%{http_code}" \ |
|
|
|
|
${scheme}${address}${resource}) |
|
|
|
|
|
|
|
|
|
# Get the http response body |
|
|
|
|
http_response_body=$(curl -k -s ${scheme}${address}${resource}) |
|
|
|
|
http_response_body=$(curl -H "User-Agent: Mozilla" -k -s ${scheme}${address}${resource}) |
|
|
|
|
|
|
|
|
|
# server returns response 403 and body "SSL required" if non-TLS |
|
|
|
|
# connection is attempted on a TLS-configured server. Change |
|
|
|
@ -44,7 +46,7 @@ healthcheck_main () { |
|
|
|
|
if [ "$http_response" = "403" ] && \ |
|
|
|
|
[ "$http_response_body" = "SSL required" ]; then |
|
|
|
|
scheme="https://" |
|
|
|
|
http_response=$(curl -s -k -o /dev/null -I -w "%{http_code}" \ |
|
|
|
|
http_response=$(curl -H "User-Agent: Mozilla" -s -k -o /dev/null -I -w "%{http_code}" \ |
|
|
|
|
${scheme}${address}${resource}) |
|
|
|
|
fi |
|
|
|
|
|