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:
authorTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-09-12 16:51:54 +0300
committerTuomo Ala-Vannesluoma <tuomoav@gmail.com>2018-09-12 16:51:54 +0300
commit2c766aba4f008c4a80e328a4eabbaae186276fc9 (patch)
tree2130329afb0346592b23b26ae2de825dc0fb4857 /internal/domain
parentcdf67e05dc6de54790d899d350acf863ac4eceb1 (diff)
Avoid caching if project is access controlled
Diffstat (limited to 'internal/domain')
-rw-r--r--internal/domain/domain.go8
1 files changed, 5 insertions, 3 deletions
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)