Skip to content

Commit

Permalink
fix: http template host header rewrite(#12385) (#12386)
Browse files Browse the repository at this point in the history
Signed-off-by: Bryce-Huang <44901318+Bryce-huang@users.noreply.github.com>
  • Loading branch information
Bryce-huang authored and sarabala1979 committed Jan 8, 2024
1 parent 5c0ecde commit e8cc715
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion workflow/executor/agent.go
Expand Up @@ -8,6 +8,7 @@ import (
"fmt"
"io"
"net/http"
"strings"
"sync"
"time"

Expand Down Expand Up @@ -341,7 +342,12 @@ func (ae *AgentExecutor) executeHTTPTemplateRequest(ctx context.Context, httpTem
}
value = string(secret)
}
request.Header.Add(header.Name, value)
// for rewrite host header
if strings.ToLower(header.Name) == "host" {
request.Host = value
} else {
request.Header.Add(header.Name, value)
}
}

response, err := httpClients[httpTemplate.InsecureSkipVerify].Do(request)
Expand Down

0 comments on commit e8cc715

Please sign in to comment.