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 <[email protected]>
  • Loading branch information
Bryce-huang authored Jan 8, 2024
1 parent 9391426 commit 98b578e
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion workflow/executor/agent.go
Original file line number Diff line number Diff line change
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 98b578e

Please sign in to comment.