summaryrefslogtreecommitdiff
path: root/modules/caddyhttp/caddyhttp.go
diff options
context:
space:
mode:
Diffstat (limited to 'modules/caddyhttp/caddyhttp.go')
-rw-r--r--modules/caddyhttp/caddyhttp.go12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/caddyhttp/caddyhttp.go b/modules/caddyhttp/caddyhttp.go
index ae73c98..467b40f 100644
--- a/modules/caddyhttp/caddyhttp.go
+++ b/modules/caddyhttp/caddyhttp.go
@@ -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)