@marcel91200 / caddy Mirror · read-only / commits / d55d50b3
Fork 0

Fast and extensible multi-platform HTTP/1-2-3 web server with automatic HTTPS

Mirrored from https://github.com/Slazee/caddy.git

Synced Nov 14, 05:15 UTC

reverseproxy: Enforce port range size of 1 at provision (#3695)

* reverse_proxy: ensure upstream address has port range of only 1 * reverse_proxy: don't log the error if upstream range size is more than 1

Mohammed Al Sahaf committed Sep 17, 2020 at 04:48 UTC d55d50b3b3a9a8e842bb25e1ee8468587cd346f4
1 file changed +7
modules/caddyhttp/reverseproxy/reverseproxy.go
+7
@@ -204,6 +204,13 @@ func (h *Handler) Provision(ctx caddy.Context) error {
204
205 // set up upstreams
206 for _, upstream := range h.Upstreams {
207 + addr, err := caddy.ParseNetworkAddress(upstream.Dial)
208 + if err != nil {
209 + return err
210 + }
211 + if addr.PortRangeSize() != 1 {
212 + return fmt.Errorf("multiple addresses (upstream must map to only one address): %v", addr)
213 + }
214 // create or get the host representation for this upstream
215 var host Host = new(upstreamHost)
216 existingHost, loaded := hosts.LoadOrStore(upstream.String(), host)