reverseproxy: fix upstream scheme handling in command (#5088)

e338648fed introduced multiple upstream
addresses. A comment notes that mixing schemes isn't supported and
therefore the first valid scheme is supposed to be used.

Fixes setting the first scheme.

fixes #5087
This commit is contained in:
lemmi 2022-09-27 21:03:30 +02:00 committed by GitHub
parent b5727b9c44
commit d0556929a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -117,7 +117,7 @@ func cmdReverseProxy(fs caddycmd.Flags) (int, error) {
if err != nil {
return caddy.ExitCodeFailedStartup, fmt.Errorf("invalid upstream address %s: %v", toLoc, err)
}
if scheme != "" && toScheme != "" {
if scheme != "" && toScheme == "" {
toScheme = scheme
}
toAddresses[i] = addr