diff --git a/composition/composition_handler.go b/composition/composition_handler.go index b03ba3a..afefb14 100644 --- a/composition/composition_handler.go +++ b/composition/composition_handler.go @@ -47,7 +47,7 @@ func (agg *CompositionHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) for _, res := range results { if res.Err == nil && res.Content != nil { - if res.Content.HttpStatusCode() == 301 || res.Content.HttpStatusCode() == 302 || res.Content.HttpStatusCode() == 303 { + if res.Content.HttpStatusCode() >= 300 && res.Content.HttpStatusCode() <= 308 { copyHeaders(res.Content.HttpHeader(), w.Header(), ForwardResponseHeaders) w.WriteHeader(res.Content.HttpStatusCode()) return diff --git a/composition/http_content_loader_test.go b/composition/http_content_loader_test.go index 11f42bd..69bc87c 100644 --- a/composition/http_content_loader_test.go +++ b/composition/http_content_loader_test.go @@ -222,7 +222,7 @@ func Test_HttpContentLoader_FollowRedirects(t *testing.T) { func Test_HttpContentLoader_DoNotFollowRedirects(t *testing.T) { a := assert.New(t) - for _, status := range []int{301, 302, 303} { + for _, status := range []int{301, 302, 303, 305, 307, 308} { server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if r.URL.Path != "/redirected" { http.Redirect(w, r, "/redirected", status)