John Heyer
John Heyer

Reputation: 921

GCP Healthcheck that accepts non-200 code

Have a use case where I need to check an HTTP web server's health, but need to accept a non-200 code (so 3xx, 4xx, and even 5xx).

I know this isn't possible with HTTP or HTTPS checks, but it seems it is possible with a TCP check:

https://cloud.google.com/load-balancing/docs/health-checks#create-hc

But I can't find any real-world examples, and am not sure on the syntax needed. I'm trying this:

Request: GET / HTTP/1.1\nHost: localhost.localdomain\n

Response: HTTP/1.1

packet captures show the request sent to the web server, but it doesn't show anything in the logs which indicates it doesn't consider this a valid HTTP request.

A basic TCP check isn't adequate because I want to catch cases where the web server is responding to the TCP 3-way handshake, but is unable to return a valid HTTP response.

Upvotes: 0

Views: 43

Answers (0)

Related Questions