Browse Source

reverse_proxy: Fix invalid argument to Intn in RandomChoice selection

master
Matthew Holt 5 years ago
parent
commit
8de1a76227
No known key found for this signature in database GPG Key ID: 2A349DD577D586A5
  1. 2
      modules/caddyhttp/reverseproxy/selectionpolicies.go

2
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
}

Loading…
Cancel
Save