From 54104351f2c3e85ebabf98fa3921a9f1c736c601 Mon Sep 17 00:00:00 2001 From: Sammy Huang Date: Tue, 14 Jul 2020 09:40:51 +0800 Subject: [PATCH] [patch] allow caching it when http response code 302 is got from upstream --- proxy/router.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy/router.go b/proxy/router.go index fe24361..ed2f18c 100644 --- a/proxy/router.go +++ b/proxy/router.go @@ -67,7 +67,7 @@ func NewRouter(srv *Server, opts *RouterOptions) *Router { TLSClientConfig: &tls.Config{InsecureSkipVerify: true}, } rt.proxy.ModifyResponse = func(r *http.Response) error { - if r.StatusCode == http.StatusOK { + if r.StatusCode == http.StatusOK || r.StatusCode == http.StatusFound { var buf []byte if strings.Contains(r.Header.Get("Content-Encoding"), "gzip") { gr, err := gzip.NewReader(r.Body)