|
|
@ -15,6 +15,8 @@ |
|
|
|
# limitations under the License. |
|
|
|
# limitations under the License. |
|
|
|
# |
|
|
|
# |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set -x |
|
|
|
|
|
|
|
|
|
|
|
_init () { |
|
|
|
_init () { |
|
|
|
scheme="http://" |
|
|
|
scheme="http://" |
|
|
|
address="127.0.0.1:9000" |
|
|
|
address="127.0.0.1:9000" |
|
|
@ -32,11 +34,11 @@ healthcheck_main () { |
|
|
|
exit 0 |
|
|
|
exit 0 |
|
|
|
else |
|
|
|
else |
|
|
|
# Get the http response code |
|
|
|
# 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}) |
|
|
|
${scheme}${address}${resource}) |
|
|
|
|
|
|
|
|
|
|
|
# Get the http response body |
|
|
|
# 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 |
|
|
|
# server returns response 403 and body "SSL required" if non-TLS |
|
|
|
# connection is attempted on a TLS-configured server. Change |
|
|
|
# connection is attempted on a TLS-configured server. Change |
|
|
@ -44,7 +46,7 @@ healthcheck_main () { |
|
|
|
if [ "$http_response" = "403" ] && \ |
|
|
|
if [ "$http_response" = "403" ] && \ |
|
|
|
[ "$http_response_body" = "SSL required" ]; then |
|
|
|
[ "$http_response_body" = "SSL required" ]; then |
|
|
|
scheme="https://" |
|
|
|
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}) |
|
|
|
${scheme}${address}${resource}) |
|
|
|
fi |
|
|
|
fi |
|
|
|
|
|
|
|
|