Accept cookies for analytics, social media, and advertising, or learn more and adjust your preferences. These cookies are on by default for visitors outside the UK and EEA. Privacy Notice.
ngx_http_healthcheck_module - polls backends and if they respond with HTTP 200 + an optional request body, they are marked good. Otherwise, they are marked bad.
You can get the module from GitHub
Note
This also gives you access to a health status page that lets you seehow well your healthcheck are doing.
Note
This module is not distributed with the NGINX source. See the installation instructions.
Warning
The docs on this wiki can get out of date. For the authoritative information, please see the README file inside the plugin’s git repository
Syntax: | healthcheck_enabled |
---|---|
Default: | none |
Context: | upstream |
Enables health checking of an upstream
Syntax: | healthcheck_delay <milliseconds> |
---|---|
Default: | 10000 |
Context: | upstream |
Delay in msec between healthchecks for a single peer.
Syntax: | healthcheck_timeout <milliseconds> |
---|---|
Default: | 2000 |
Context: | upstream |
How many milliseconds a healthcheck is allowed to take place
Syntax: | healthcheck_failcount <count> |
---|---|
Default: | 2 |
Context: | upstream |
Number of healthchecks good or bad in a row it takes to switch from down to up and back. Good to prevent flapping
Syntax: | healthcheck_send <content> |
---|---|
Default: | empty |
Context: | upstream |
Required directive. What to send for the healthcheck. Each argument is appended by rn and the entire thing is suffixed with another rn. For example,
healthcheck_send 'GET /health HTTP/1.0'
'Host: www.yourhost.com';
Note
You probably want to end your health check with some directive that closes the connection, like Connection: close.
Syntax: | healthcheck_expected <content> |
---|---|
Default: | unset |
Context: | upstream |
What to expect in the HTTP BODY, (meaning not the headers), in a correct response. If unset, just a HTTP 200 status code is required for a peer
Syntax: | healthcheck_buffer <size> |
---|---|
Default: | 1000 |
Context: | upstream |
How big a buffer to use for the health check. Remember to include headers PLUS body, not just body.
Syntax: | healthcheck_status |
---|---|
Default: | none |
Context: | upstream |
When inside a /location block, replaced the HTTP body with backend health status. Use similarly to the stub_status module.