diff --git a/adapter/inbound/socket.go b/adapter/inbound/socket.go index 4024ee42..a6b1288c 100644 --- a/adapter/inbound/socket.go +++ b/adapter/inbound/socket.go @@ -42,6 +42,8 @@ func NewInner(conn net.Conn, dst string, host string) *context.ConnContext { if host == "" { if ip, err := netip.ParseAddr(h); err == nil { metadata.DstIP = ip + } else { + metadata.Host = h } } } diff --git a/component/http/http.go b/component/http/http.go index eb8478cd..ece7b442 100644 --- a/component/http/http.go +++ b/component/http/http.go @@ -53,7 +53,7 @@ func HttpRequest(ctx context.Context, url, method string, header map[string][]st TLSHandshakeTimeout: 10 * time.Second, ExpectContinueTimeout: 1 * time.Second, DialContext: func(ctx context.Context, network, address string) (net.Conn, error) { - conn := inner.HandleTcp(address, urlRes.Hostname()) + conn := inner.HandleTcp(address, "") return conn, nil }, TLSClientConfig: tls.GetDefaultTLSConfig(),