proxyprotocol: Add PROXY protocol support to reverse_proxy, add HTTP listener wrapper (#5424)

Co-authored-by: WeidiDeng <weidi_deng@icloud.com>
Co-authored-by: Francis Lavoie <lavofr@gmail.com>
This commit is contained in:
Corin Langosch
2023-03-31 23:44:53 +02:00
committed by GitHub
parent 66e571e687
commit b6fe5d4b41
9 changed files with 245 additions and 1 deletions

View File

@ -918,6 +918,17 @@ func (h *HTTPTransport) UnmarshalCaddyfile(d *caddyfile.Dispenser) error {
}
h.MaxResponseHeaderSize = int64(size)
case "proxy_protocol":
if !d.NextArg() {
return d.ArgErr()
}
switch proxyProtocol := d.Val(); proxyProtocol {
case "v1", "v2":
h.ProxyProtocol = proxyProtocol
default:
return d.Errf("invalid proxy protocol version '%s'", proxyProtocol)
}
case "dial_timeout":
if !d.NextArg() {
return d.ArgErr()