The traffic_router_health.vcl file is a VCL include that enables the Traffic Router to probe the
health of a Varnish instance through Varnish itself. It serves the agent’s health check data
(traffic_router_health.json) in response to router health probe requests.
The Traffic Router needs to know whether each Varnish endpoint is healthy, in maintenance, or down
before making routing decisions. Rather than querying a sidecar service, the router sends a specially
crafted HTTP request directly to the Varnish instance. The traffic_router_health.vcl include
intercepts this request and serves the health check JSON file from disk using the Varnish Enterprise
file VMOD.
The router identifies its health probe requests with:
GETapplication/vnd.router.healthcheck+jsonVarnish Request RouterWhen all three conditions match, the request is handled internally and never reaches the origin backend. The health check handler returns early when it matches a probe request, so it does not interfere with normal request processing.
For shared deployments (the default deployment type), the agent automatically generates a root
VCL that already includes traffic_router_health.vcl. No action is required from the user.
When using a root deployment, the Varnish Controller does not generate a root VCL, you provide your own. In this case, add the following line to your VCL:
vcl 4.1;
import ...;
include "traffic_router_health.vcl";
# Your VCL logic here
The include statement should be placed near the top of the file, before any subroutine
definitions. Since VCL subroutines are concatenated when multiple definitions exist, the health
check logic will be prepended to your own vcl_recv and vcl_backend_response subroutines.
The health check handler returns early when it matches a probe request, so it does not interfere
with normal request processing.
The include should appear before your vcl_recv definition. VCL processes subroutines in
definition order, and the health check handler uses return (pass) to exit early when it detects a
probe request. If your vcl_recv appears first and returns before the health check logic runs, the
router probes will not be handled correctly.
Accept header and
User-Agent match are intercepted.status field in the health check JSON.