mirror of
https://github.com/caddyserver/caddy.git
synced 2025-06-01 00:43:23 +08:00
Fix rehandling bug
This commit is contained in:
@ -85,6 +85,10 @@ func (app *App) Provision(ctx caddy.Context) error {
|
||||
return fmt.Errorf("setting up server error handling routes: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
if srv.MaxRehandles == nil {
|
||||
srv.MaxRehandles = &DefaultMaxRehandles
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
@ -111,8 +115,8 @@ func (app *App) Validate() error {
|
||||
|
||||
// each server's max rehandle value must be valid
|
||||
for srvName, srv := range app.Servers {
|
||||
if srv.MaxRehandles < 0 {
|
||||
return fmt.Errorf("%s: invalid max_rehandles value: %d", srvName, srv.MaxRehandles)
|
||||
if srv.MaxRehandles != nil && *srv.MaxRehandles < 0 {
|
||||
return fmt.Errorf("%s: invalid max_rehandles value: %d", srvName, *srv.MaxRehandles)
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,6 +439,10 @@ const (
|
||||
DefaultHTTPSPort = 443
|
||||
)
|
||||
|
||||
// DefaultMaxRehandles is the maximum number of rehandles to
|
||||
// allow, if not specified explicitly.
|
||||
var DefaultMaxRehandles = 3
|
||||
|
||||
// Interface guards
|
||||
var (
|
||||
_ caddy.App = (*App)(nil)
|
||||
|
Reference in New Issue
Block a user