Skip to content

docs: Add example for health_upstream #406

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion src/docs/markdown/caddyfile/directives/reverse_proxy.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ reverse_proxy [<matcher>] [<upstreams...>] {

# active health checking
health_uri <uri>
health_upstream <ip:port>
health_port <port>
health_interval <interval>
health_timeout <duration>
Expand Down Expand Up @@ -319,7 +320,9 @@ Active health checks perform health checking in the background on a timer. To en

- **health_uri** <span id="health_uri"/> is the URI path (and optional query) for active health checks.

- **health_port** <span id="health_port"/> is the port to use for active health checks, if different from the upstream's port.
- **health_upstream** <span id="health_upstream"/> is the ip:port to use for active health checks, if different from the upstream. This should be used in tandem with `health_header` and `{http.reverse_proxy.active.target_upstream}`.

- **health_port** <span id="health_port"/> is the port to use for active health checks, if different from the upstream's port. Ignored if `health_upstream` is used.

- **health_interval** <span id="health_interval"/> is a [duration value](/docs/conventions#durations) that defines how often to perform active health checks. Default: `30s`.

Expand Down Expand Up @@ -852,3 +855,16 @@ example.com {
```


Using [active health checks](#active-health-checks) and `health_upstream` can be helpful when creating an intermediate service to do a more thorough health check. `{http.reverse_proxy.active.target_upstream}` can then be used as a header to provide the original upstream to the health check service.

```caddy
example.com {
reverse_proxy node1:80 node2:80 node3:80 {
health_uri /health
health_upstream 127.0.0.1:53336
health_headers {
Full-Upstream {http.reverse_proxy.active.target_upstream}
}
}
}
```