summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorMatthew Holt <mholt@users.noreply.github.com>2019-11-27 11:51:32 -0700
committerMatthew Holt <mholt@users.noreply.github.com>2019-11-27 11:51:32 -0700
commitdb4293cb5fce33b467b50ef77698f69a4a066215 (patch)
treed05ec08e4d191667de09064b77629ec9acfab729 /modules
parent6e10586303fd90f0298c8086e754b35dfc3f01ba (diff)
reverse_proxy: Add flush_interval to caddyfile syntax (#1460)
Also add godoc for Caddyfile syntax for file_server
Diffstat (limited to 'modules')
-rw-r--r--modules/caddyhttp/fileserver/caddyfile.go10
-rw-r--r--modules/caddyhttp/reverseproxy/caddyfile.go13
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)