github.com/magento/magento2/blob/2.4.7-beta2/pub/health_check.php
Varnish’s health check feature polls the Magento server to determine whether it is responding in a timely manner.
- If it is responding normally, fresh content will be regenerated after the Time to Live (TTL) period has expired.
- If not, Varnish always serves stale content.
Magento defines the following default health check:
.probe = {
.url = "/pub/health_check.php";
.timeout = 2s;
.interval = 5s;
.window = 10;
.threshold = 5;
}
Every 5 seconds, this health check calls the
pub/health_check.php script
.
This script checks the availability of the server, each database, and Redis (if installed).
The script must return a response within 2 seconds.
If the script determines that any of these resources are down, it returns a 500 HTTP error code.
If this error code is received in 6 out of 10 attempts, the backend is considered unhealthy.The
health_check.php
script is located in thepub
directory.
If your Magento root directory ispub
, then be sure to change the path in the url parameter from/pub/health_check.php
tohealth_check.php
.For more information, see the Varnish health checks documentation.