fix localhost target URI issue

pull/17821/head
Chris Thain 2023-06-20 11:32:26 -07:00
parent 500dcb1f21
commit 391db7e58b
2 changed files with 5 additions and 2 deletions

View File

@ -652,7 +652,10 @@ func (t *Target) validate() error {
addr := strings.Split(t.URI, ":")
if len(addr) == 2 {
t.host = addr[0]
if t.host != "localhost" && t.host != "127.0.0.1" {
if t.host == "localhost" || t.host == "127.0.0.1" {
// Always use the IP address form.
t.host = "127.0.0.1"
} else {
resultErr = multierror.Append(resultErr, fmt.Errorf("invalid host for Target.URI %q: expected 'localhost' or '127.0.0.1'", t.URI))
}
if t.port, err = strconv.Atoi(addr[1]); err != nil {

View File

@ -12,7 +12,7 @@ import (
)
func makeExtAuthzEnvoyExtension(svc string, opts ...string) []structs.EnvoyExtension {
target := map[string]any{"URI": "127.0.0.1:9191"}
target := map[string]any{"URI": "localhost:9191"}
insertOptions := map[string]any{}
required := false
ent := false