mirror of
https://github.com/caddyserver/caddy.git
synced 2024-12-26 21:53:48 +03:00
caddyhttp: Make route provisioning idempotent (#6558)
ref: https://github.com/caddyserver/caddy/issues/6551
This commit is contained in:
parent
c050a37e1c
commit
91e62db666
1 changed files with 3 additions and 0 deletions
|
@ -159,6 +159,9 @@ func (r *Route) ProvisionHandlers(ctx caddy.Context, metrics *Metrics) error {
|
||||||
r.Handlers = append(r.Handlers, handler.(MiddlewareHandler))
|
r.Handlers = append(r.Handlers, handler.(MiddlewareHandler))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Make ProvisionHandlers idempotent by clearing the middleware field
|
||||||
|
r.middleware = []Middleware{}
|
||||||
|
|
||||||
// pre-compile the middleware handler chain
|
// pre-compile the middleware handler chain
|
||||||
for _, midhandler := range r.Handlers {
|
for _, midhandler := range r.Handlers {
|
||||||
r.middleware = append(r.middleware, wrapMiddleware(ctx, midhandler, metrics))
|
r.middleware = append(r.middleware, wrapMiddleware(ctx, midhandler, metrics))
|
||||||
|
|
Loading…
Reference in a new issue