From 4cd7ae35b3ec3d882168cef669974a2c3aab3618 Mon Sep 17 00:00:00 2001 From: Francis Lavoie Date: Tue, 8 Sep 2020 12:37:46 -0400 Subject: [PATCH] reverseproxy: Add `buffer_requests` option to `reverse_proxy` directive (#3710) --- caddytest/integration/caddyfile_adapt/reverse_proxy_h2c.txt | 2 ++ modules/caddyhttp/reverseproxy/caddyfile.go | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/caddytest/integration/caddyfile_adapt/reverse_proxy_h2c.txt b/caddytest/integration/caddyfile_adapt/reverse_proxy_h2c.txt index 7c4ba297..9f3bc93f 100644 --- a/caddytest/integration/caddyfile_adapt/reverse_proxy_h2c.txt +++ b/caddytest/integration/caddyfile_adapt/reverse_proxy_h2c.txt @@ -10,6 +10,7 @@ https://example.com { versions h2c 2 compression off } + buffer_requests } } @@ -38,6 +39,7 @@ https://example.com { { "handle": [ { + "buffer_requests": true, "handler": "reverse_proxy", "headers": { "request": { diff --git a/modules/caddyhttp/reverseproxy/caddyfile.go b/modules/caddyhttp/reverseproxy/caddyfile.go index 8c3b1184..33f6e7b5 100644 --- a/modules/caddyhttp/reverseproxy/caddyfile.go +++ b/modules/caddyhttp/reverseproxy/caddyfile.go @@ -467,6 +467,12 @@ func (h *Handler) UnmarshalCaddyfile(d *caddyfile.Dispenser) error { h.FlushInterval = caddy.Duration(dur) } + case "buffer_requests": + if d.NextArg() { + return d.ArgErr() + } + h.BufferRequests = true + case "header_up": if h.Headers == nil { h.Headers = new(headers.Handler)