From 1ac9c410a3ef50c686c1b6963409142903578ba8 Mon Sep 17 00:00:00 2001 From: "Alex Ellis (VMware)" Date: Fri, 19 Oct 2018 14:30:50 +0100 Subject: [PATCH] Don't follow redirects This change is part of https://github.com/openfaas/faas/pull/925 which prevents redirects from being followed on the server-side and means a function can allow the caller / client to follow the redirect as intended. Signed-off-by: Alex Ellis (VMware) --- executor/http_runner.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/executor/http_runner.go b/executor/http_runner.go index 21fcc9ce..ae7af187 100644 --- a/executor/http_runner.go +++ b/executor/http_runner.go @@ -176,6 +176,9 @@ func makeProxyClient(dialTimeout time.Duration) *http.Client { IdleConnTimeout: 500 * time.Millisecond, ExpectContinueTimeout: 1500 * time.Millisecond, }, + CheckRedirect: func(req *http.Request, via []*http.Request) error { + return http.ErrUseLastResponse + }, } return &proxyClient