From 48237e0b3c9504b6d80a0748781dfeb2d28e886d Mon Sep 17 00:00:00 2001 From: "Alex Ellis (OpenFaaS Ltd)" Date: Sun, 29 Dec 2019 12:59:13 +0000 Subject: [PATCH] Don't follow redirects Required for functioning proxy Signed-off-by: Alex Ellis (OpenFaaS Ltd) --- pkg/proxy.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/proxy.go b/pkg/proxy.go index 45715c2..772a869 100644 --- a/pkg/proxy.go +++ b/pkg/proxy.go @@ -27,6 +27,10 @@ type Proxy struct { func (p *Proxy) Start() error { tcp := 8080 + http.DefaultClient.CheckRedirect = func(req *http.Request, via []*http.Request) error { + return http.ErrUseLastResponse + } + time.Sleep(3 * time.Second) log.Printf("Starting faasd proxy on %d\n", tcp) data := struct{ host string }{