mirror of
https://github.com/fatedier/frp.git
synced 2025-06-17 00:38:22 +00:00
add header for http health check
This commit is contained in:
parent
5507467fb3
commit
bb7d51b0db
@ -42,7 +42,6 @@ type Monitor struct {
|
|||||||
// For http
|
// For http
|
||||||
url string
|
url string
|
||||||
header http.Header
|
header http.Header
|
||||||
host string
|
|
||||||
failedTimes uint64
|
failedTimes uint64
|
||||||
statusOK bool
|
statusOK bool
|
||||||
statusNormalFn func()
|
statusNormalFn func()
|
||||||
@ -87,7 +86,6 @@ func NewMonitor(ctx context.Context, cfg v1.HealthCheckConfig, addr string,
|
|||||||
addr: addr,
|
addr: addr,
|
||||||
url: url,
|
url: url,
|
||||||
header: header,
|
header: header,
|
||||||
host: cfg.HostHeaderRewrite,
|
|
||||||
statusOK: false,
|
statusOK: false,
|
||||||
statusNormalFn: statusNormalFn,
|
statusNormalFn: statusNormalFn,
|
||||||
statusFailedFn: statusFailedFn,
|
statusFailedFn: statusFailedFn,
|
||||||
@ -172,7 +170,7 @@ func (monitor *Monitor) doHTTPCheck(ctx context.Context) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
req.Header = monitor.header
|
req.Header = monitor.header
|
||||||
req.Host = monitor.host
|
req.Host = monitor.header.Get("Host")
|
||||||
resp, err := http.DefaultClient.Do(req)
|
resp, err := http.DefaultClient.Do(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -220,7 +220,6 @@ healthCheck.timeoutSeconds = 3
|
|||||||
healthCheck.headers=[
|
healthCheck.headers=[
|
||||||
{ name = "x-from-where", value = "frp" }
|
{ name = "x-from-where", value = "frp" }
|
||||||
]
|
]
|
||||||
healthCheck.hostHeaderRewrite = "example.com"
|
|
||||||
|
|
||||||
[[proxies]]
|
[[proxies]]
|
||||||
name = "web02"
|
name = "web02"
|
||||||
|
@ -100,9 +100,6 @@ type HealthCheckConfig struct {
|
|||||||
// Headers specifies the headers to send health checks to if the
|
// Headers specifies the headers to send health checks to if the
|
||||||
// health check type is "http".
|
// health check type is "http".
|
||||||
Headers []HTTPHeader `json:"headers,omitempty"`
|
Headers []HTTPHeader `json:"headers,omitempty"`
|
||||||
// HostHeaderRewrite specifies the request host to send health checks to if the
|
|
||||||
// health check type is "http".
|
|
||||||
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type DomainConfig struct {
|
type DomainConfig struct {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user