mirror of
https://github.com/kemko/nomad.git
synced 2026-01-01 16:05:42 +03:00
Handle Consul API URL protocol mismatch (#10082)
This commit is contained in:
@@ -1064,6 +1064,10 @@ func (e *external) addr(defaultAddr string) string {
|
||||
if strings.HasPrefix(e.addrVal, "http:") {
|
||||
return e.addrVal
|
||||
}
|
||||
if strings.HasPrefix(e.addrVal, "https:") {
|
||||
// Mismatch: e.ssl=false but addrVal is https
|
||||
return strings.ReplaceAll(e.addrVal, "https://", "http://")
|
||||
}
|
||||
return "http://" + e.addrVal
|
||||
}
|
||||
|
||||
@@ -1072,7 +1076,8 @@ func (e *external) addr(defaultAddr string) string {
|
||||
}
|
||||
|
||||
if strings.HasPrefix(e.addrVal, "http:") {
|
||||
return "https:" + e.addrVal[5:]
|
||||
// Mismatch: e.ssl=true but addrVal is http
|
||||
return strings.ReplaceAll(e.addrVal, "http://", "https://")
|
||||
}
|
||||
|
||||
return "https://" + e.addrVal
|
||||
|
||||
Reference in New Issue
Block a user