mirror of https://github.com/caddyserver/caddy.git
reverse_proxy: Add flush_interval to caddyfile syntax (#1460)
Also add godoc for Caddyfile syntax for file_server
This commit is contained in:
parent
6e10586303
commit
db4293cb5f
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue