HAProxy Enterprise Documentation 10.5

HTTP

To check a real server's availability by running a GET HTTP request, use the following directive:

option httpcheck [interval <seconds>] [timeout <seconds>] [source <ip>] [port <port>] [uri <uri>] [statuscode <code>]

This directive takes the following arguments:

interval <seconds> (optional)

Interval between two checks, in seconds (default: 10 seconds)

timeout <seconds> (optional)

Period after which an attempt without a response from the server is considered as failed (default: 3 seconds)

source <ip> (optional)

Source IP to use when performing the check

port <port> (optional)

Forces the destination port (default: real server port, if it exists)

uri <string> (optional)

URI requested (default: the root /)

vhost <string> (optional)

Virtual Host to test (otherwise, the real server IP is used)

statuscode <code> (optional)

Expected status code (default: code 200)

Check the availability of an HTTP application hosted on app.domain.com server:

director d_http
  # ...
  option httpcheck port 80 uri /check vhost app.domain.com interval 5s timeout 1s
  server web1 10.0.0.1:443 check
  server web2 10.0.0.2:443 check