diff options
author | Grzegorz Bizon <grzegorz@gitlab.com> | 2022-01-03 12:56:21 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzegorz@gitlab.com> | 2022-01-03 12:56:21 +0300 |
commit | 5913265aaf405fe47ce70db8e43950b6408eb0ec (patch) | |
tree | 1ec505b39acc78b89ed45325b6487d201593d619 | |
parent | 2abb995aeb613f184ee0adebfcbd5597ee210169 (diff) | |
parent | d40af81155fdd50f7ea3b78249cc303b91acf63e (diff) |
Merge branch 'remove-cache-ff' into 'master'
feat: enable Etag caching
Closes #672
See merge request gitlab-org/gitlab-pages!653
-rw-r--r-- | internal/feature/feature.go | 6 | ||||
-rw-r--r-- | internal/serving/disk/reader.go | 7 | ||||
-rw-r--r-- | test/acceptance/zip_test.go | 7 |
3 files changed, 1 insertions, 19 deletions
diff --git a/internal/feature/feature.go b/internal/feature/feature.go index 68c27e40..0a29f4a4 100644 --- a/internal/feature/feature.go +++ b/internal/feature/feature.go @@ -19,12 +19,6 @@ var RedirectsPlaceholders = Feature{ EnvVariable: "FF_ENABLE_PLACEHOLDERS", } -// HandleCacheHeaders enables handling cache headers when serving from compressed ZIP archives -// TODO: enable and remove https://gitlab.com/gitlab-org/gitlab-pages/-/issues/672 -var HandleCacheHeaders = Feature{ - EnvVariable: "FF_HANDLE_CACHE_HEADERS", -} - // Enabled reads the environment variable responsible for the feature flag // if FF is disabled by default, the environment variable needs to be "true" to explicitly enable it // if FF is enabled by default, variable needs to be "false" to explicitly disable it diff --git a/internal/serving/disk/reader.go b/internal/serving/disk/reader.go index b83425eb..5961d843 100644 --- a/internal/serving/disk/reader.go +++ b/internal/serving/disk/reader.go @@ -14,7 +14,6 @@ import ( "github.com/prometheus/client_golang/prometheus" "gitlab.com/gitlab-org/labkit/errortracking" - "gitlab.com/gitlab-org/gitlab-pages/internal/feature" "gitlab.com/gitlab-org/gitlab-pages/internal/httperrors" "gitlab.com/gitlab-org/gitlab-pages/internal/logging" "gitlab.com/gitlab-org/gitlab-pages/internal/redirects" @@ -235,11 +234,7 @@ func (reader *Reader) serveFile(ctx context.Context, w http.ResponseWriter, r *h http.ServeContent(w, r, origPath, fi.ModTime(), rs) } else { w.Header().Set("Content-Length", strconv.FormatInt(fi.Size(), 10)) - if feature.HandleCacheHeaders.Enabled() { - vfsServing.ServeCompressedFile(w, r, fi.ModTime(), file) - } else { - io.Copy(w, file) - } + vfsServing.ServeCompressedFile(w, r, fi.ModTime(), file) } return true diff --git a/test/acceptance/zip_test.go b/test/acceptance/zip_test.go index 42734d14..dcb831e7 100644 --- a/test/acceptance/zip_test.go +++ b/test/acceptance/zip_test.go @@ -10,14 +10,9 @@ import ( "time" "github.com/stretchr/testify/require" - - "gitlab.com/gitlab-org/gitlab-pages/internal/feature" - "gitlab.com/gitlab-org/gitlab-pages/internal/testhelpers" ) func TestZipServing(t *testing.T) { - testhelpers.StubFeatureFlagValue(t, feature.HandleCacheHeaders.EnvVariable, true) - runObjectStorage(t, "../../shared/pages/group/zip.gitlab.io/public.zip") RunPagesProcess(t, @@ -243,8 +238,6 @@ func TestZipServingCache(t *testing.T) { } func TestZipServingFromDisk(t *testing.T) { - testhelpers.StubFeatureFlagValue(t, feature.HandleCacheHeaders.EnvVariable, true) - RunPagesProcess(t, withListeners([]ListenSpec{httpListener}), ) |