diff options
author | Nick Thomas <nick@gitlab.com> | 2017-07-03 18:22:50 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-07-03 18:36:16 +0300 |
commit | 8a8dedae07f2323bf74c9c8508ce4f8ff67bc7db (patch) | |
tree | 581971be54469c5ac85fb2faab1ca9ba6f0c8bee /domain.go | |
parent | 62409e8cb2dc856134587c3479f0a3da8b3da53b (diff) |
Add simple Cache-Control and Expires headers to 200 OK responses
Diffstat (limited to 'domain.go')
-rw-r--r-- | domain.go | 5 |
1 files changed, 5 insertions, 0 deletions
@@ -11,6 +11,7 @@ import ( "path/filepath" "strconv" "strings" + "time" "gitlab.com/gitlab-org/gitlab-pages/internal/httputil" ) @@ -72,6 +73,10 @@ func (d *domain) serveFile(w http.ResponseWriter, r *http.Request, origPath stri 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)) + fmt.Println("Serving", fullPath, "for", r.URL.Path) // ServeContent sets Content-Type for us |