Skip to content
This repository was archived by the owner on Nov 23, 2019. It is now read-only.

Commit 1376e4b

Browse files
committed
Set fake host header for local communication.
Signed-off-by: Lantao Liu <[email protected]>
1 parent 37cc88a commit 1376e4b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

client/request.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,13 @@ func (cli *Client) sendClientRequest(ctx context.Context, method, path string, q
8383
}
8484

8585
req, err := cli.newRequest(method, path, query, body, headers)
86-
req.URL.Host = cli.addr
86+
host := cli.addr
87+
if cli.proto == "unix" || cli.proto == "npipe" {
88+
// For local communications, it doesn't matter what the host is. We just
89+
// need a valid and meaningful host name. (See #189)
90+
host = "docker"
91+
}
92+
req.URL.Host = host
8793
req.URL.Scheme = cli.transport.Scheme()
8894

8995
if expectedPayload && req.Header.Get("Content-Type") == "" {

0 commit comments

Comments
 (0)