Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrContainerNotFound = errors.New("container not found")
ErrContainerNotFound is returned when the Docker container for a request is missing.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// Path used for health probing. Defaults to "/health".
HealthPath string `json:"health_path,omitempty"`
// Max time to start (or find) the container and pass health checks.
// Defaults to 30s.
Timeout caddy.Duration `json:"timeout,omitempty"`
// Interval between health probes. Defaults to 300ms.
PollInterval caddy.Duration `json:"poll_interval,omitempty"`
// Dial timeout for health probe HTTP client. Defaults to 3s.
ProbeDialTimeout caddy.Duration `json:"probe_dial_timeout,omitempty"`
RedirectURL string `json:"redirect_url,omitempty"` // e.g. "https://storrito.localhost/signup"
RedirectCode int `json:"redirect_code,omitempty"` // 301, 302, 303, 307, or 308 (default 307)
// contains filtered or unexported fields
}
Handler is a Caddy HTTP middleware that ensures the derived Docker container is running and healthy before proxying the request to it.
func (*Handler) UnmarshalCaddyfile ¶
UnmarshalCaddyfile supports a simple Caddyfile block:
docker_start_proxy {
health_path /health
timeout 30s
poll_interval 300ms
probe_dial_timeout 3s
redirect_url https://example.com/fallback
redirect_code 307
}
Click to show internal directories.
Click to hide internal directories.