Add upstream_timeout as env-var

Signed-off-by: Alex Ellis <alexellis2@gmail.com>
This commit is contained in:
Alex Ellis
2018-03-05 12:29:13 +00:00
parent 30928739ee
commit 6efaee5b4f
3 changed files with 10 additions and 6 deletions

View File

@ -65,7 +65,8 @@ func forwardRequest(w http.ResponseWriter, r *http.Request, proxyClient *http.Cl
defer r.Body.Close()
upstreamReq.Body = r.Body
}
ctx, cancel := context.WithTimeout(context.Background(), timeout-time.Second*1)
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
res, resErr := proxyClient.Do(upstreamReq.WithContext(ctx))