1
Fork 0
mirror of https://github.com/caddyserver/caddy.git synced 2024-12-16 21:56:40 -05:00

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

View file

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