diff options
author | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2018-09-12 16:51:54 +0300 |
---|---|---|
committer | Tuomo Ala-Vannesluoma <tuomoav@gmail.com> | 2018-09-12 16:51:54 +0300 |
commit | 2c766aba4f008c4a80e328a4eabbaae186276fc9 (patch) | |
tree | 2130329afb0346592b23b26ae2de825dc0fb4857 /internal/domain | |
parent | cdf67e05dc6de54790d899d350acf863ac4eceb1 (diff) |
Avoid caching if project is access controlled
Diffstat (limited to 'internal/domain')
-rw-r--r-- | internal/domain/domain.go | 8 |
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) |