summaryrefslogtreecommitdiff
path: root/modules/caddyhttp
diff options
context:
space:
mode:
authorFrancis Lavoie <lavofr@gmail.com>2020-11-02 16:59:02 -0500
committerGitHub <noreply@github.com>2020-11-02 14:59:02 -0700
commit860cc6adfe6a5022baf5fd387e0d10c5e3a174fe (patch)
tree76dc64fadf31b04769b0a7c9ab10e41763dca91d /modules/caddyhttp
parent8d038ca515ffaa4d37dca05a95181203b2db64e7 (diff)
reverseproxy: Wire up some http transport options in Caddyfile (#3843)
Diffstat (limited to 'modules/caddyhttp')
-rw-r--r--modules/caddyhttp/reverseproxy/caddyfile.go50
1 files changed, 47 insertions, 3 deletions
diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go
index 7fa118c..c5f8e17 100644
--- a/modules/caddyhttp/reverseproxy/caddyfile.go
+++ b/modules/caddyhttp/reverseproxy/caddyfile.go
@@ -586,9 +586,13 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
// UnmarshalCaddyfile deserializes Caddyfile tokens into h.
//
// transport http {
-// read_buffer <size>
-// write_buffer <size>
-// dial_timeout <duration>
+// read_buffer <size>
+// write_buffer <size>
+// max_response_header <size>
+// dial_timeout <duration>
+// dial_fallback_delay <duration>
+// response_header_timeout <duration>
+// expect_continue_timeout <duration>
// tls
// tls_client_auth <automate_name> | <cert_file> <key_file>
// tls_insecure_skip_verify
@@ -627,6 +631,16 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
}
h.WriteBufferSize = int(size)
+ case "max_response_header":
+ if !d.NextArg() {
+ return d.ArgErr()
+ }
+ size, err := humanize.ParseBytes(d.Val())
+ if err != nil {
+ return d.Errf("invalid max response header size '%s': %v", d.Val(), err)
+ }
+ h.MaxResponseHeaderSize = int64(size)
+
case "dial_timeout":
if !d.NextArg() {
return d.ArgErr()
@@ -637,6 +651,36 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
}
h.DialTimeout = caddy.Duration(dur)
+ case "dial_fallback_delay":
+ if !d.NextArg() {
+ return d.ArgErr()
+ }
+ dur, err := caddy.ParseDuration(d.Val())
+ if err != nil {
+ return d.Errf("bad fallback delay value '%s': %v", d.Val(), err)
+ }
+ h.FallbackDelay = caddy.Duration(dur)
+
+ case "response_header_timeout":
+ if !d.NextArg() {
+ return d.ArgErr()
+ }
+ dur, err := caddy.ParseDuration(d.Val())
+ if err != nil {
+ return d.Errf("bad timeout value '%s': %v", d.Val(), err)
+ }
+ h.ResponseHeaderTimeout = caddy.Duration(dur)
+
+ case "expect_continue_timeout":
+ if !d.NextArg() {
+ return d.ArgErr()
+ }
+ dur, err := caddy.ParseDuration(d.Val())
+ if err != nil {
+ return d.Errf("bad timeout value '%s': %v", d.Val(), err)
+ }
+ h.ExpectContinueTimeout = caddy.Duration(dur)
+
case "tls_client_auth":
if h.TLS == nil {
h.TLS = new(TLSConfig)