mirror of
https://github.com/caddyserver/caddy.git
synced 2025-04-25 06:14:04 +08:00
transport not exported for active health check
This commit is contained in:
parent
be406bc4c9
commit
7a805e8d6b
@ -94,7 +94,6 @@ type ActiveHealthChecks struct {
|
|||||||
// Configures the method of transport for the active health checker.
|
// Configures the method of transport for the active health checker.
|
||||||
// The default transport is the handler's transport
|
// The default transport is the handler's transport
|
||||||
TransportRaw json.RawMessage `json:"transport,omitempty" caddy:"namespace=http.reverse_proxy.health_checks.active.transport inline_key=protocol"`
|
TransportRaw json.RawMessage `json:"transport,omitempty" caddy:"namespace=http.reverse_proxy.health_checks.active.transport inline_key=protocol"`
|
||||||
Transport http.RoundTripper `json:"transport,omitempty"`
|
|
||||||
|
|
||||||
// HTTP headers to set on health check requests.
|
// HTTP headers to set on health check requests.
|
||||||
Headers http.Header `json:"headers,omitempty"`
|
Headers http.Header `json:"headers,omitempty"`
|
||||||
@ -134,6 +133,7 @@ type ActiveHealthChecks struct {
|
|||||||
// body of a healthy backend.
|
// body of a healthy backend.
|
||||||
ExpectBody string `json:"expect_body,omitempty"`
|
ExpectBody string `json:"expect_body,omitempty"`
|
||||||
|
|
||||||
|
transport http.RoundTripper `json:"transport,omitempty"`
|
||||||
uri *url.URL
|
uri *url.URL
|
||||||
httpClient *http.Client
|
httpClient *http.Client
|
||||||
bodyRegexp *regexp.Regexp
|
bodyRegexp *regexp.Regexp
|
||||||
@ -187,14 +187,14 @@ func (a *ActiveHealthChecks) Provision(ctx caddy.Context, h *Handler) error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("loading transport: %v", err)
|
return fmt.Errorf("loading transport: %v", err)
|
||||||
}
|
}
|
||||||
a.Transport = mod.(http.RoundTripper)
|
a.transport = mod.(http.RoundTripper)
|
||||||
} else {
|
} else {
|
||||||
a.Transport = h.Transport
|
a.transport = h.Transport
|
||||||
}
|
}
|
||||||
|
|
||||||
a.httpClient = &http.Client{
|
a.httpClient = &http.Client{
|
||||||
Timeout: timeout,
|
Timeout: timeout,
|
||||||
Transport: a.Transport,
|
Transport: a.transport,
|
||||||
CheckRedirect: func(req *http.Request, via []*http.Request) error {
|
CheckRedirect: func(req *http.Request, via []*http.Request) error {
|
||||||
if !a.FollowRedirects {
|
if !a.FollowRedirects {
|
||||||
return http.ErrUseLastResponse
|
return http.ErrUseLastResponse
|
||||||
|
Loading…
x
Reference in New Issue
Block a user