backend-defaults: add backend.health.headers config
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -38,3 +38,29 @@ backend.add(
|
||||
}),
|
||||
);
|
||||
```
|
||||
|
||||
### Custom headers in health check responses
|
||||
|
||||
While not implemented directly in the root health service, the default implementation of the [RootHttpRouter](./root-http-router.md) service includes a configuration option to set additional headers to include in health check responses. For example, you can add a `service-name` header using the following configuration:
|
||||
|
||||
```yaml
|
||||
backend:
|
||||
health:
|
||||
headers:
|
||||
service-name: my-service
|
||||
```
|
||||
|
||||
It can be a good idea to set a header for your health check responses that
|
||||
uniquely identifies your service in a multi-service environment. This ensures
|
||||
that the health check that is configured for your service is actually hitting
|
||||
your service and not another.
|
||||
|
||||
For example, if using Envoy you can use the [`service_name_matcher`](https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/upstream/health_checking#health-check-identity) configuration and
|
||||
set the `x-envoy-upstream-healthchecked-cluster` header to a matching value. For example:
|
||||
|
||||
```yaml
|
||||
backend:
|
||||
health:
|
||||
headers:
|
||||
x-envoy-upstream-healthchecked-cluster: my-service
|
||||
```
|
||||
|
||||
Reference in New Issue
Block a user