summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMatthew Holt <[email protected]>2024-04-17 19:59:10 -0600
committerMatthew Holt <[email protected]>2024-04-17 19:59:10 -0600
commit9ab09433deba62f9f2b37d824570926f7ee69312 (patch)
tree1a96b6d4cc85ffe9a30946cb61aa3206ab639402
parent3067074d9cf94dba8b27c31408b71c9f75defb40 (diff)
downloadcaddy-9ab09433deba62f9f2b37d824570926f7ee69312.tar.gz
caddy-9ab09433deba62f9f2b37d824570926f7ee69312.zip
encode: Slight fix for the previous commit
-rw-r--r--modules/caddyhttp/encode/encode.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/modules/caddyhttp/encode/encode.go b/modules/caddyhttp/encode/encode.go
index f4bd7ae43..0c8a10de1 100644
--- a/modules/caddyhttp/encode/encode.go
+++ b/modules/caddyhttp/encode/encode.go
@@ -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