mirror of
https://github.com/coredns/coredns.git
synced 2025-11-02 18:23:25 -05:00
plugin/health: Bypass proxy in self health check (#5401)
* add detail to docs; bypass proxy in self health check Signed-off-by: Chris O'Haver <cohaver@infoblox.com>
This commit is contained in:
@@ -2,6 +2,7 @@ package health
|
||||
|
||||
import (
|
||||
"context"
|
||||
"net"
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
@@ -13,9 +14,22 @@ import (
|
||||
|
||||
// overloaded queries the health end point and updates a metrics showing how long it took.
|
||||
func (h *health) overloaded(ctx context.Context) {
|
||||
bypassProxy := &http.Transport{
|
||||
Proxy: nil,
|
||||
DialContext: (&net.Dialer{
|
||||
Timeout: 30 * time.Second,
|
||||
KeepAlive: 30 * time.Second,
|
||||
}).DialContext,
|
||||
ForceAttemptHTTP2: true,
|
||||
MaxIdleConns: 100,
|
||||
IdleConnTimeout: 90 * time.Second,
|
||||
TLSHandshakeTimeout: 10 * time.Second,
|
||||
ExpectContinueTimeout: 1 * time.Second,
|
||||
}
|
||||
timeout := 3 * time.Second
|
||||
client := http.Client{
|
||||
Timeout: timeout,
|
||||
Timeout: timeout,
|
||||
Transport: bypassProxy,
|
||||
}
|
||||
|
||||
url := "http://" + h.Addr + "/health"
|
||||
|
||||
Reference in New Issue
Block a user