0

Load Balancer health check on VM (running Apache2 on Ubuntu) works fine when path is set to '/'. Health Check is pretty simple over HTTP on port 80. Load Balancer and VM communicate over HTTP:80 and external requests on HTTP are redirtected to HTTPS with 301 response if

RewriteCond %{HTTP:X-Forwarded-Proto} =http

As this is the home page of the app and little heavy on content, I decided to move health check to some other html page which is light to process. In other words I updated Path from '/' to '/some-dir/some-page.html' After doing this health check fails. There are many similar questions but none of them is helpful in this case. It might be that 301 response from VM might fail the health check but it works for '/'. Why health check fails if Path is updated? Strangely, same health check ('/' to '/some-dir/some-page.html') when applied to unmanaged Instance Group works pretty well. Any help would be appreciated.

Health Check details -

$ gcloud compute health-checks describe health-check-name
checkIntervalSec: 5
creationTimestamp: '2023-06-01T19:21:19.177-07:00'
description: ''
healthyThreshold: 2
httpHealthCheck:
host: ''       
port: 80
  proxyHeader: NONE
  requestPath: /some-dir/some-page.html
id: '7467560598743870704'
kind: compute#healthCheck
logConfig:
  enable: false
name: dp-instance-heartbeat-check-exclude-home
selfLink: https://www.googleapis.com/compute/v1/projects/
              project-name/global/healthChecks/health-check-name
timeoutSec: 5
type: HTTP
unhealthyThreshold: 2

result of curl -v example.com/some-dir/some-page.html

StatusCode        : 200
StatusDescription : OK
Content           : <!DOCTYPE HTML>...
RawContent        : HTTP/1.1 200 OK
                    Pragma: no-cache...
Forms             : {}
Headers           : {[Pragma, no-cache], [Cache-Control,...}
ParsedHtml        : mshtml.HTMLDocumentClass
.....
RawContentLength  : 114051
  • What is the result of `curl -v example.com/some-dir/some-page.html` The HTTP Status Code must be 200 (`HTTP/1.1 200 OK`). Add the command response to your question. Add details on how you configure the health check from `gcloud compute health-checks describe`. – John Hanley Jun 02 '23 at 04:26
  • VM added to unmanaged Instance Group has GoogleHC entries in Apache Log but these are not available on VM under managed Instance Group. In fact VM under managed Instance Group has no entries for GoogleHC in User Agent - test.example.com:80 - - - [02/Jun/2023:11:52:23 +0530] "GET /some-dir/some-page.html HTTP/1.1" 200 125179 "-" "GoogleHC/1.0" – Sharad Upadhyay Jun 02 '23 at 06:23
  • It looks Health Check is not getting performed by Load Balancer Proxy on updating the Path. Otherwise VM Apache2 Log should have 301, 302, 404, 500, etc. entries (even if 200 OK was not received). Health Check fails without VM receiving any request for Health Check looks pretty strange. This Backend service was created couple of years ago (probably 4-5 years or more), if nothing works I have to create/clone a new backend service and check it. If someone can tell me what is the default User Agent for Health Check on *legacy* backend services it would be helpful to investigate the case further. – Sharad Upadhyay Jun 02 '23 at 07:15

0 Answers0