Skip to content

Commit

Permalink
Merge pull request #356 from askuy/feature/fixclienthttps
Browse files Browse the repository at this point in the history
fixclienthttps
  • Loading branch information
askuy authored Aug 11, 2023
2 parents 2ec6c2d + 7ec7d04 commit 081a0ae
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion client/ehttp/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,13 @@ func newComponent(name string, config *Config, logger *elog.Component) *Componen
if err != nil {
elog.Panic("parse addr error", elog.FieldErr(err), elog.FieldKey(config.Addr))
}
addr := strings.ReplaceAll(config.Addr, egoTarget.Scheme+"://", "http://")
// 这里的目的是为了,将k8s:// 替换为 http://,所以需要判断下是否为非HTTP,HTTPS。
// 因为resty默认只要http和https的协议
addr := config.Addr
if egoTarget.Scheme != "http" && egoTarget.Scheme != "https" {
// 因为内部协议,都是内网,所以直接替换为HTTP
addr = strings.ReplaceAll(config.Addr, egoTarget.Scheme+"://", "http://")
}
builder := resolver.Get(egoTarget.Scheme)
resolver, err := builder.Build(addr)
if err != nil {
Expand Down

0 comments on commit 081a0ae

Please sign in to comment.