Skip to content

Commit

Permalink
Fix set Cache-Control header position
Browse files Browse the repository at this point in the history
  • Loading branch information
toshinari123 committed Jan 9, 2024
1 parent eb4731b commit 8bdb787
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*.test
*.out
go.work

pageship
*.local
.env
dist/
/book
/book
3 changes: 1 addition & 2 deletions internal/handler/site/site_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ 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 @@ -72,9 +71,9 @@ 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))
w.Header().Set("Cache-Control", "public, max-age=31536000, no-cache")
}

reader := &lazyReader{
Expand Down

0 comments on commit 8bdb787

Please sign in to comment.