Skip to content

Commit

Permalink
Add Cache-Control header
Browse files Browse the repository at this point in the history
  • Loading branch information
toshinari123 committed Jan 2, 2024
1 parent 859784c commit eb4731b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/handler/site/site_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ func (h *SiteHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
}
h.next.ServeHTTP(w, r)

w.Header().Set("Cache-Control", "public, max-age=31536000, no-cache")
case http.MethodOptions:
w.Header().Set("Allow", options)

Expand All @@ -71,6 +72,7 @@ func (h *SiteHandler) serveFile(w http.ResponseWriter, r *http.Request) {
if info.ContentType != "" {
w.Header().Set("Content-Type", info.ContentType)
}
w.Header().Set("Cache-Control", "public, max-age=31536000, no-cache")
if info.Hash != "" {
w.Header().Set("ETag", fmt.Sprintf(`"%s"`, info.Hash))
}
Expand Down
Binary file added pageship
Binary file not shown.

0 comments on commit eb4731b

Please sign in to comment.