Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

https health check fails when REQUEST and RESPONSE are used

I have a https health check on port 443 that works when I leave the REQUEST and RESPONSE fields  empty. This health check is used by my External passthrough Network Load Balancer.
It works as expected when I stop and start one of the backend http servers.

But when I fill in the REQUEST and RESPONSE fields as:
  REQUEST= /health.html
  RESPONSE= SERVERUP
The health check marks both backend server down even though both servers return the expected string when I view https://myserver.com/health.html in a browser.

What am I doing wrong?

==== Here is the REST for my health check: ======
{
"checkIntervalSec": 15,
"creationTimestamp": "2024-10-15T07:51:32.184-07:00",
"description": "",
"healthyThreshold": 2,
"id": "71xxxxxx07",
"kind": "compute#healthCheck",
"logConfig": {
"enable": true
},
"name": "https-healthcheck-443",
"region": "projects/myproject-test/regions/us-central1",
"selfLink": "projects/myproject-test/regions/us-central1/healthChecks/https-healthcheck-443",
"tcpHealthCheck": {
"request": "/health.html",
"port": 443,
"response": "SERVERUP",
"proxyHeader": "NONE"
},
"timeoutSec": 5,
"type": "TCP",
"unhealthyThreshold": 2
}


==== here is log entry when its working =========
{
"insertId": "dxxxxxxy",
"jsonPayload": {
"healthCheckProbeResult": {
"probeCompletionTimestamp": "2024-10-16T00:32:29.005066094Z",
"connectLatency": "0.000606s",
"probeSourceIp": "209.85.205.208",
"previousDetailedHealthState": "UNHEALTHY",
"healthState": "HEALTHY",
"targetIp": "34.xxx.xxx.xxx",
"previousHealthState": "UNHEALTHY",
"healthCheckProtocol": "TCP",
"detailedHealthState": "HEALTHY",
"ipAddress": "10.128.0.2",
"targetPort": 443,
"responseLatency": "0.000606s"
}
},
"resource": {
"type": "gce_instance_group",
"labels": {
"project_id": "myproject-test",
"instance_group_name": "ig-uscentral1-c",
"instance_group_id": "3xxxxxxxx0",
"location": "us-central1-c"
}
},
"timestamp": "2024-10-16T00:32:30.550095356Z",
"severity": "INFO",
"logName": "projects/myproject-test/logs/compute.googleapis.com%2Fhealthchecks",
"receiveTimestamp": "2024-10-16T00:32:31.797024936Z"
}


====== here is log entry when it fails ======================
{
"insertId": "ixxxxxxu",
"jsonPayload": {
"healthCheckProbeResult": {
"healthCheckProtocol": "TCP",
"targetPort": 443,
"probeSourceIp": "209.85.205.197",
"connectLatency": "0.000405s",
"probeResultText": "Connection closed.",
"responseLatency": "0.001018s",
"ipAddress": "10.128.0.2",
"probeCompletionTimestamp": "2024-10-16T00:37:52.411035527Z",
"previousDetailedHealthState": "UNKNOWN",
"probeRequest": "/health.html",
"targetIp": "34.xxx.xx.xx",
"previousHealthState": "UNHEALTHY",
"healthState": "UNHEALTHY",
"detailedHealthState": "TIMEOUT"
}
},
"resource": {
"type": "gce_instance_group",
"labels": {
"project_id": "myproject-test",
"instance_group_name": "ig-uscentral1-c",
"instance_group_id": "37xxxxxxxxx0",
"location": "us-central1-c"
}
},
"timestamp": "2024-10-16T00:37:53.707150225Z",
"severity": "INFO",
"logName": "projects/myproject-test/logs/compute.googleapis.com%2Fhealthchecks",
"receiveTimestamp": "2024-10-16T00:37:54.954386920Z"
}

Solved Solved
0 1 156
1 ACCEPTED SOLUTION

I found the problem., I had to change the healthCheckProtocol from TCP to HTTPS.
Of course healthCheckProtocol TCP only works if you do not specify a REQUEST and RESPONSE.

View solution in original post

1 REPLY 1

I found the problem., I had to change the healthCheckProtocol from TCP to HTTPS.
Of course healthCheckProtocol TCP only works if you do not specify a REQUEST and RESPONSE.