mirror of
https://github.com/fatedier/frp.git
synced 2025-06-17 00:38:22 +00:00
Compare commits
2 Commits
5507467fb3
...
adb4d3d33d
Author | SHA1 | Date | |
---|---|---|---|
|
adb4d3d33d | ||
|
bb7d51b0db |
@ -42,7 +42,6 @@ type Monitor struct {
|
||||
// For http
|
||||
url string
|
||||
header http.Header
|
||||
host string
|
||||
failedTimes uint64
|
||||
statusOK bool
|
||||
statusNormalFn func()
|
||||
@ -75,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)
|
||||
}
|
||||
|
||||
@ -87,7 +86,6 @@ func NewMonitor(ctx context.Context, cfg v1.HealthCheckConfig, addr string,
|
||||
addr: addr,
|
||||
url: url,
|
||||
header: header,
|
||||
host: cfg.HostHeaderRewrite,
|
||||
statusOK: false,
|
||||
statusNormalFn: statusNormalFn,
|
||||
statusFailedFn: statusFailedFn,
|
||||
@ -172,7 +170,7 @@ func (monitor *Monitor) doHTTPCheck(ctx context.Context) error {
|
||||
return err
|
||||
}
|
||||
req.Header = monitor.header
|
||||
req.Host = monitor.host
|
||||
req.Host = monitor.header.Get("Host")
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -217,10 +217,9 @@ healthCheck.intervalSeconds = 10
|
||||
healthCheck.maxFailed = 3
|
||||
healthCheck.timeoutSeconds = 3
|
||||
# set health check headers
|
||||
healthCheck.headers=[
|
||||
healthCheck.httpheaders=[
|
||||
{ name = "x-from-where", value = "frp" }
|
||||
]
|
||||
healthCheck.hostHeaderRewrite = "example.com"
|
||||
|
||||
[[proxies]]
|
||||
name = "web02"
|
||||
|
@ -99,10 +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"`
|
||||
// HostHeaderRewrite specifies the request host to send health checks to if the
|
||||
// health check type is "http".
|
||||
HostHeaderRewrite string `json:"hostHeaderRewrite,omitempty"`
|
||||
HTTPHeaders []HTTPHeader `json:"httpHeaders,omitempty"`
|
||||
}
|
||||
|
||||
type DomainConfig struct {
|
||||
|
Loading…
x
Reference in New Issue
Block a user