Skip to content

Commit

Permalink
encode: Slight fix for the previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mholt committed Apr 18, 2024
1 parent 3067074 commit 9ab0943
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions modules/caddyhttp/encode/encode.go
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,11 @@ func (enc *Encode) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyh
// we have to strip our addition so the upstream handlers can still honor client
// caches without knowing about our changes...
if etag := r.Header.Get("If-None-Match"); etag != "" && !strings.HasPrefix(etag, "W/") {
etag = strings.TrimSuffix(etag, "-"+encName+`"`) + `"`
r.Header.Set("If-None-Match", etag)
ourSuffix := "-" + encName + `"`
if strings.HasSuffix(etag, ourSuffix) {
etag = strings.TrimSuffix(etag, ourSuffix) + `"`
r.Header.Set("If-None-Match", etag)
}
}

break
Expand Down

0 comments on commit 9ab0943

Please sign in to comment.