aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJesper Brix Rosenkilde <[email protected]>2024-09-03 19:57:55 +0200
committerGitHub <[email protected]>2024-09-03 11:57:55 -0600
commit91e62db666b799ba4bb6577d8548fbe779d91c28 (patch)
treec6fc9f41cc2707366e11a02ffcae53c2b1073e49
parentc050a37e1c3228708a6716c8971361134243e941 (diff)
downloadcaddy-91e62db666b799ba4bb6577d8548fbe779d91c28.tar.gz
caddy-91e62db666b799ba4bb6577d8548fbe779d91c28.zip
caddyhttp: Make route provisioning idempotent (#6558)
ref: https://github.com/caddyserver/caddy/issues/6551
-rw-r--r--modules/caddyhttp/routes.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/modules/caddyhttp/routes.go b/modules/caddyhttp/routes.go
index 6f2371495..54a3f38e6 100644
--- a/modules/caddyhttp/routes.go
+++ b/modules/caddyhttp/routes.go
@@ -159,6 +159,9 @@ func (r *Route) ProvisionHandlers(ctx caddy.Context, metrics *Metrics) error {
r.Handlers = append(r.Handlers, handler.(MiddlewareHandler))
}
+ // Make ProvisionHandlers idempotent by clearing the middleware field
+ r.middleware = []Middleware{}
+
// pre-compile the middleware handler chain
for _, midhandler := range r.Handlers {
r.middleware = append(r.middleware, wrapMiddleware(ctx, midhandler, metrics))