summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/caddylog/log.go2
-rw-r--r--modules/caddyhttp/headers/headers.go2
-rw-r--r--modules/caddyhttp/markdown/markdown.go2
-rw-r--r--modules/caddyhttp/requestbody/requestbody.go2
-rwxr-xr-xmodules/caddyhttp/reverseproxy/module.go2
-rwxr-xr-xmodules/caddyhttp/reverseproxy/upstream.go16
-rw-r--r--modules/caddyhttp/table.go2
7 files changed, 18 insertions, 10 deletions
diff --git a/modules/caddyhttp/caddylog/log.go b/modules/caddyhttp/caddylog/log.go
index 1ac249c..902f60f 100644
--- a/modules/caddyhttp/caddylog/log.go
+++ b/modules/caddyhttp/caddylog/log.go
@@ -25,7 +25,7 @@ import (
func init() {
caddy.RegisterModule(caddy.Module{
- Name: "http.middleware.log",
+ Name: "http.handlers.log",
New: func() interface{} { return new(Log) },
})
}
diff --git a/modules/caddyhttp/headers/headers.go b/modules/caddyhttp/headers/headers.go
index f1b45da..8f4976a 100644
--- a/modules/caddyhttp/headers/headers.go
+++ b/modules/caddyhttp/headers/headers.go
@@ -24,7 +24,7 @@ import (
func init() {
caddy.RegisterModule(caddy.Module{
- Name: "http.middleware.headers",
+ Name: "http.handlers.headers",
New: func() interface{} { return new(Headers) },
})
}
diff --git a/modules/caddyhttp/markdown/markdown.go b/modules/caddyhttp/markdown/markdown.go
index 146a60d..b9a2a91 100644
--- a/modules/caddyhttp/markdown/markdown.go
+++ b/modules/caddyhttp/markdown/markdown.go
@@ -29,7 +29,7 @@ import (
func init() {
caddy.RegisterModule(caddy.Module{
- Name: "http.middleware.markdown",
+ Name: "http.handlers.markdown",
New: func() interface{} { return new(Markdown) },
})
}
diff --git a/modules/caddyhttp/requestbody/requestbody.go b/modules/caddyhttp/requestbody/requestbody.go
index 14743f4..3763cfe 100644
--- a/modules/caddyhttp/requestbody/requestbody.go
+++ b/modules/caddyhttp/requestbody/requestbody.go
@@ -23,7 +23,7 @@ import (
func init() {
caddy.RegisterModule(caddy.Module{
- Name: "http.middleware.request_body",
+ Name: "http.handlers.request_body",
New: func() interface{} { return new(RequestBody) },
})
}
diff --git a/modules/caddyhttp/reverseproxy/module.go b/modules/caddyhttp/reverseproxy/module.go
index 72946b7..2e6a338 100755
--- a/modules/caddyhttp/reverseproxy/module.go
+++ b/modules/caddyhttp/reverseproxy/module.go
@@ -21,7 +21,7 @@ import (
// Register caddy module.
func init() {
caddy.RegisterModule(caddy.Module{
- Name: "http.responders.reverse_proxy",
+ Name: "http.handlers.reverse_proxy",
New: func() interface{} { return new(LoadBalanced) },
})
}
diff --git a/modules/caddyhttp/reverseproxy/upstream.go b/modules/caddyhttp/reverseproxy/upstream.go
index a7fea3e..9409ee7 100755
--- a/modules/caddyhttp/reverseproxy/upstream.go
+++ b/modules/caddyhttp/reverseproxy/upstream.go
@@ -28,6 +28,7 @@ import (
"sync/atomic"
"time"
+ "github.com/caddyserver/caddy/modules/caddyhttp"
"github.com/caddyserver/caddy/v2"
)
@@ -120,7 +121,7 @@ func NewLoadBalancedReverseProxy(lb *LoadBalanced, ctx caddy.Context) error {
}
// setup any configured circuit breakers
- var cbModule = "http.responders.reverse_proxy.circuit_breaker"
+ var cbModule = "http.handlers.reverse_proxy.circuit_breaker"
var cb CircuitBreaker
if uc.CircuitBreaker != nil {
@@ -209,9 +210,9 @@ func (lb *LoadBalanced) Provision(ctx caddy.Context) error {
return NewLoadBalancedReverseProxy(lb, ctx)
}
-// ServeHTTP implements the http.Handler interface to dispatch an http request to the proper
-// server.
-func (lb *LoadBalanced) ServeHTTP(w http.ResponseWriter, r *http.Request) error {
+// ServeHTTP implements the caddyhttp.MiddlewareHandler interface to
+// dispatch an HTTP request to the proper server.
+func (lb *LoadBalanced) ServeHTTP(w http.ResponseWriter, r *http.Request, _ caddyhttp.Handler) error {
// ensure requests don't hang if an upstream does not respond or is not eventually healthy
var u *upstream
var done bool
@@ -440,3 +441,10 @@ func newReverseProxy(target *url.URL, setHealthiness func(bool)) *ReverseProxy {
rp.Transport = defaultTransport // use default transport that times out in 5 seconds
return rp
}
+
+// Interface guards
+var (
+ _ caddyhttp.MiddlewareHandler = (*LoadBalanced)(nil)
+ _ caddy.Provisioner = (*LoadBalanced)(nil)
+ _ caddy.CleanerUpper = (*LoadBalanced)(nil)
+)
diff --git a/modules/caddyhttp/table.go b/modules/caddyhttp/table.go
index 7d98682..5b1fed5 100644
--- a/modules/caddyhttp/table.go
+++ b/modules/caddyhttp/table.go
@@ -22,7 +22,7 @@ import (
func init() {
caddy.RegisterModule(caddy.Module{
- Name: "http.middleware.table",
+ Name: "http.handlers.table",
New: func() interface{} { return new(tableMiddleware) },
})