From 8de1a762273323608d9d9080c42057d1814070b6 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Mon, 18 Nov 2019 14:22:55 -0700 Subject: reverse_proxy: Fix invalid argument to Intn in RandomChoice selection --- modules/caddyhttp/reverseproxy/selectionpolicies.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'modules') diff --git a/modules/caddyhttp/reverseproxy/selectionpolicies.go b/modules/caddyhttp/reverseproxy/selectionpolicies.go index e34dd9b..a21e44c 100644 --- a/modules/caddyhttp/reverseproxy/selectionpolicies.go +++ b/modules/caddyhttp/reverseproxy/selectionpolicies.go @@ -132,7 +132,7 @@ func (r RandomChoiceSelection) Select(pool UpstreamPool, _ *http.Request) *Upstr if !upstream.Available() { continue } - j := weakrand.Intn(i) + j := weakrand.Intn(i + 1) if j < k { choices[j] = upstream } -- cgit v1.2.3