F5 HTTP Health Check Monitors (error/status codes)

There are so many ways to do this but below are some examples and will help get started.

#Types of HTTP Error and Status Codes:
100-199: informational status
200-299: success status
300-399: redirection status
400-499: client errors
500-599: server errors


#Send String: Just some quick examples
GET /index.html HTTP/1.0\r\n\r\n
POST /form.cgi HTTP/1.0\r\n\r\nFirst=Kerry&Last=Cordero

1.1: For HTTP 1.1 requests, the Host header is required:
HEAD /dev/weberv1 HTTP/1.1\r\nHost: cordero.me\r\nConnection: Close\r\n\r\n
GET /index.html HTTP/1.1\r\nHost: host.cordero.me\r\nConnection: Close\r\n\r\n
POST /form.cgi HTTP/1.1\r\nHost: host.cordero.me\r\nConnection: Close\r\n\r\nFirst=Kerry&Last=Cordero


#Receive String: Just some quick examples
HTTP/1\.[01] [23]0[0-6] Accepts 200-206 and 300-306everything else like 4xx and 5xx results in a non-matching value and will fail the check
HTTP/1\.[01] [2]0[0-6] Accepts only 200-206 


#HTTP and HTTPS Monitors:
HTTP Monitor:
Type: HTTP
Parent Monitor: http
Send String: HEAD / HTTP/1.0
Receive String: HTTP/1\.[01] [23]0[0-6]

HTTPS Monitor:
Parent Monitor: https
Send String: GET / HTTP/1.1\r\nHost: cordero.me\r\nConnection: Close\r\n\r\n
Receive String: HTTP/1\.[01] [23]0[0-6]

For the “Receive String” you can also use text from the site like the response headers.  You can also use a string from the content of the page.

#How to test HTTP Status Codes and get Data from the Site:

Using curl, you can use “-I”:

#curl -I --http1.1 http://cordero.me
HTTP/1.1 301 Moved Permanently
Server: nginx
Date: Tue, 16 Nov 2021 20:42:09 GMT
Content-Type: text/html
Content-Length: 162
Connection: keep-alive
Location: https://cordero.me/
Host-Header: 8441280b0c35cbc1147f8ba998a563a7
X-HTTPS-Enforce: 1
X-Proxy-Cache-Info: DT:1

#curl -I --http1.1 https://cordero.me
HTTP/1.1 200 OK
Server: nginx
Date: Tue, 16 Nov 2021 20:42:16 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding
X-Cache-Enabled: True
Link: <https://cordero.me/wp-json/>; rel="https://api.w.org/"
X-Httpd: 1
Host-Header: 8441280b0c35cbc1147f8ba998a563a7
X-Proxy-Cache-Info: DT:1

Use “-k” to get data from the site.