Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-pages.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--acceptance_test.go1
-rw-r--r--internal/domain/domain.go8
2 files changed, 6 insertions, 3 deletions
diff --git a/acceptance_test.go b/acceptance_test.go
index 19d1c4c9..f0cdc749 100644
--- a/acceptance_test.go
+++ b/acceptance_test.go
@@ -897,6 +897,7 @@ func TestAccessControl(t *testing.T) {
defer rsp.Body.Close()
assert.Equal(t, c.Status, rsp.StatusCode)
+ assert.Equal(t, "", rsp.Header.Get("Cache-Control"))
if c.RedirectBack {
url, err = url.Parse(rsp.Header.Get("Location"))
diff --git a/internal/domain/domain.go b/internal/domain/domain.go
index 2b6e83bd..d98a0b91 100644
--- a/internal/domain/domain.go
+++ b/internal/domain/domain.go
@@ -206,9 +206,11 @@ func (d *D) serveFile(w http.ResponseWriter, r *http.Request, origPath string) e
return err
}
- // Set caching headers
- w.Header().Set("Cache-Control", "max-age=600")
- w.Header().Set("Expires", time.Now().Add(10*time.Minute).Format(time.RFC1123))
+ if !d.IsAccessControlEnabled(r) {
+ // Set caching headers
+ w.Header().Set("Cache-Control", "max-age=600")
+ w.Header().Set("Expires", time.Now().Add(10*time.Minute).Format(time.RFC1123))
+ }
// ServeContent sets Content-Type for us
http.ServeContent(w, r, origPath, fi.ModTime(), file)