diff --git a/transport/internet/httpupgrade/config.go b/transport/internet/httpupgrade/config.go new file mode 100644 index 000000000..21841bfdd --- /dev/null +++ b/transport/internet/httpupgrade/config.go @@ -0,0 +1,12 @@ +package httpupgrade + +func (c *Config) GetNormalizedPath() string { + path := c.Path + if path == "" { + return "/" + } + if path[0] != '/' { + return "/" + path + } + return path +} diff --git a/transport/internet/httpupgrade/dialer.go b/transport/internet/httpupgrade/dialer.go index 493dd426e..4e8e5b551 100644 --- a/transport/internet/httpupgrade/dialer.go +++ b/transport/internet/httpupgrade/dialer.go @@ -20,7 +20,7 @@ func dialhttpUpgrade(ctx context.Context, dest net.Destination, streamSettings * if err != nil { return nil, newError("failed to dial request to ", dest).Base(err) } - req, err := http.NewRequest("GET", "/"+transportConfiguration.Path, nil) + req, err := http.NewRequest("GET", transportConfiguration.GetNormalizedPath(), nil) if err != nil { return nil, err }