mirror of
https://github.com/caddyserver/caddy.git
synced 2025-02-17 23:45:41 -05:00
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
2 changed files with 23 additions and 0 deletions
|
@ -27,6 +27,16 @@ func init() {
|
||||||
httpcaddyfile.RegisterDirective("try_files", parseTryFiles)
|
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) {
|
func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error) {
|
||||||
var fsrv FileServer
|
var fsrv FileServer
|
||||||
|
|
||||||
|
|
|
@ -68,6 +68,9 @@ func parseCaddyfile(h httpcaddyfile.Helper) (caddyhttp.MiddlewareHandler, error)
|
||||||
// unhealthy_status <status>
|
// unhealthy_status <status>
|
||||||
// unhealthy_latency <duration>
|
// unhealthy_latency <duration>
|
||||||
//
|
//
|
||||||
|
// # streaming
|
||||||
|
// flush_interval <duration>
|
||||||
|
//
|
||||||
// # header manipulation
|
// # header manipulation
|
||||||
// header_up [+|-]<field> [<value|regexp> [<replacement>]]
|
// header_up [+|-]<field> [<value|regexp> [<replacement>]]
|
||||||
// header_down [+|-]<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)
|
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":
|
case "header_up":
|
||||||
if h.Headers == nil {
|
if h.Headers == nil {
|
||||||
h.Headers = new(headers.Handler)
|
h.Headers = new(headers.Handler)
|
||||||
|
|
Loading…
Add table
Reference in a new issue