diff options
-rw-r--r-- | modules/caddyhttp/fileserver/caddyfile.go | 10 | ||||
-rw-r--r-- | modules/caddyhttp/reverseproxy/caddyfile.go | 13 |
2 files changed, 23 insertions, 0 deletions
diff --git a/modules/caddyhttp/fileserver/caddyfile.go b/modules/caddyhttp/fileserver/caddyfile.go index 06540bc..46bc5b7 100644 --- a/modules/caddyhttp/fileserver/caddyfile.go +++ b/modules/caddyhttp/fileserver/caddyfile.go @@ -27,6 +27,16 @@ func init() { httpcaddyfile.RegisterDirective("try_files", parseTryFiles) } +// parseCaddyfile parses the file_server directive. It enables the static file +// server and configures it with this syntax: +// +// file_server [<matcher>] [browse] { +// root <path> +// hide <files...> +// index <files...> +// browse [<template_file>] +// } +// func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) { var fsrv FileServer diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go index 6b1ec69..c8cf26e 100644 --- a/modules/caddyhttp/reverseproxy/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/caddyfile.go @@ -68,6 +68,9 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) // unhealthy_status <status> // unhealthy_latency <duration> // +// # streaming +// flush_interval <duration> +// // # header manipulation // header_up [+|-]<field> [<value|regexp> [<replacement>]] // header_down [+|-]<field> [<value|regexp> [<replacement>]] @@ -328,6 +331,16 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { } h.HealthChecks.Passive.UnhealthyLatency = caddy.Duration(dur) + case "flush_interval": + if !d.NextArg() { + return d.ArgErr() + } + dur, err := time.ParseDuration(d.Val()) + if err != nil { + return d.Errf("bad duration value '%s': %v", d.Val(), err) + } + h.FlushInterval = caddy.Duration(dur) + case "header_up": if h.Headers == nil { h.Headers = new(headers.Handler) |