diff --git a/transport/internet/http/config.go b/transport/internet/http/config.go index 989ed106..1cd7d058 100644 --- a/transport/internet/http/config.go +++ b/transport/internet/http/config.go @@ -8,7 +8,7 @@ import ( func (c *Config) getHosts() []string { if len(c.Host) == 0 { - return []string{"www.example.com"} + return []string{""} } return c.Host } diff --git a/transport/internet/http/dialer.go b/transport/internet/http/dialer.go index d0a86e8b..42a9f9b3 100644 --- a/transport/internet/http/dialer.go +++ b/transport/internet/http/dialer.go @@ -215,9 +215,16 @@ func Dial(ctx context.Context, dest net.Destination, streamSettings *internet.Me } } + Host := httpSettings.getRandomHost() + if Host == "" && net.ParseAddress(dest.NetAddr()).Family().IsDomain() { + Host = dest.Address.String() + } else if Host == "" { + Host = "www.example.com" + } + request := &http.Request{ Method: httpMethod, - Host: httpSettings.getRandomHost(), + Host: Host, Body: breader, URL: &url.URL{ Scheme: "https",