Skip to content

Commit

Permalink
caddyhttp: Make route provisioning idempotent (#6558)
Browse files Browse the repository at this point in the history
ref: #6551
  • Loading branch information
jbro authored Sep 3, 2024
1 parent c050a37 commit 91e62db
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions modules/caddyhttp/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 91e62db

Please sign in to comment.