Skip to content

Commit

Permalink
Merge pull request #13636 from Luap99/machine-port-proxy
Browse files Browse the repository at this point in the history
podman machine: fix port forwarding with proxy
  • Loading branch information
rhatdan authored Mar 24, 2022
2 parents 38e89f3 + c0bbca8 commit b6c713f
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions libpod/networking_machine.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
"net/http"
"strconv"
"strings"
"time"

"github.com/containers/common/libnetwork/types"
"github.com/sirupsen/logrus"
Expand All @@ -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, ",")
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit b6c713f

Please sign in to comment.