From adb4d3d33d1e174e252acf1d55a07758a6c3d0e1 Mon Sep 17 00:00:00 2001 From: Kaive Young Date: Wed, 20 Mar 2024 10:52:09 +0800 Subject: [PATCH] add header for http health check --- client/health/health.go | 2 +- conf/frpc_full_example.toml | 2 +- pkg/config/v1/proxy.go | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/client/health/health.go b/client/health/health.go index 34c85da5..d298e615 100644 --- a/client/health/health.go +++ b/client/health/health.go @@ -74,7 +74,7 @@ func NewMonitor(ctx context.Context, cfg v1.HealthCheckConfig, addr string, url = s + cfg.Path } header := make(http.Header) - for _, h := range cfg.Headers { + for _, h := range cfg.HTTPHeaders { header.Set(h.Name, h.Value) } diff --git a/conf/frpc_full_example.toml b/conf/frpc_full_example.toml index 1e4c9a53..4dae6b3c 100644 --- a/conf/frpc_full_example.toml +++ b/conf/frpc_full_example.toml @@ -217,7 +217,7 @@ healthCheck.intervalSeconds = 10 healthCheck.maxFailed = 3 healthCheck.timeoutSeconds = 3 # set health check headers -healthCheck.headers=[ +healthCheck.httpheaders=[ { name = "x-from-where", value = "frp" } ] diff --git a/pkg/config/v1/proxy.go b/pkg/config/v1/proxy.go index f45c001a..9d91b585 100644 --- a/pkg/config/v1/proxy.go +++ b/pkg/config/v1/proxy.go @@ -99,7 +99,7 @@ type HealthCheckConfig struct { Path string `json:"path,omitempty"` // Headers specifies the headers to send health checks to if the // health check type is "http". - Headers []HTTPHeader `json:"headers,omitempty"` + HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"` } type DomainConfig struct {