diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-03-24 13:53:57 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-24 13:53:57 -0400 |
commit | b6c713f4d7cbf039ec2c0abcb15d2307c639b026 (patch) | |
tree | 0a73c1d83c199c821d004acc2e98177da0b1a8df /libpod/networking_machine.go | |
parent | 38e89f39d62d874384515e91de9b8e51433a84d4 (diff) | |
parent | c0bbca8c44784509c728d15bcf7632bfa6779b2d (diff) | |
download | podman-b6c713f4d7cbf039ec2c0abcb15d2307c639b026.tar.gz podman-b6c713f4d7cbf039ec2c0abcb15d2307c639b026.tar.bz2 podman-b6c713f4d7cbf039ec2c0abcb15d2307c639b026.zip |
Merge pull request #13636 from Luap99/machine-port-proxy
podman machine: fix port forwarding with proxy
Diffstat (limited to 'libpod/networking_machine.go')
-rw-r--r-- | libpod/networking_machine.go | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libpod/networking_machine.go b/libpod/networking_machine.go index ca759b893..d2a6b7cfa 100644 --- a/libpod/networking_machine.go +++ b/libpod/networking_machine.go @@ -11,6 +11,7 @@ import ( "net/http" "strconv" "strings" + "time" "github.com/containers/common/libnetwork/types" "github.com/sirupsen/logrus" @@ -36,7 +37,18 @@ func requestMachinePorts(expose bool, ports []types.PortMapping) error { url = url + "unexpose" } ctx := context.Background() - client := &http.Client{} + client := &http.Client{ + Transport: &http.Transport{ + // make sure to not set a proxy here so explicitly ignore the proxy + // since we want to talk directly to gvproxy + // https://github.com/containers/podman/issues/13628 + Proxy: nil, + MaxIdleConns: 50, + IdleConnTimeout: 30 * time.Second, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + }, + } buf := new(bytes.Buffer) for num, port := range ports { protocols := strings.Split(port.Protocol, ",") @@ -78,7 +90,6 @@ func requestMachinePorts(expose bool, ports []types.PortMapping) error { } func makeMachineRequest(ctx context.Context, client *http.Client, url string, buf io.Reader) error { - //var buf io.ReadWriter req, err := http.NewRequestWithContext(ctx, http.MethodPost, url, buf) if err != nil { return err |