From 3deb58d2411dd55a084d96d9a658233152e2b6b2 Mon Sep 17 00:00:00 2001 From: Chris Lu Date: Tue, 17 Mar 2026 20:49:19 -0700 Subject: [PATCH] Include ETag header in 304 Not Modified responses matching Go behavior Go sets ETag on the response writer (via SetEtag) before the If-Modified-Since and If-None-Match conditional checks, so both 304 response paths include the ETag header. The Rust implementation was only adding ETag to 200 responses. --- seaweed-volume/src/server/handlers.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/seaweed-volume/src/server/handlers.rs b/seaweed-volume/src/server/handlers.rs index aae4f9589..0af8189d9 100644 --- a/seaweed-volume/src/server/handlers.rs +++ b/seaweed-volume/src/server/handlers.rs @@ -1006,6 +1006,9 @@ async fn get_or_head_handler_inner( resp.headers_mut() .insert(header::LAST_MODIFIED, lm.parse().unwrap()); } + // Go sets ETag before conditional checks, so 304 includes it + resp.headers_mut() + .insert(header::ETAG, etag.parse().unwrap()); return resp; } } @@ -1022,6 +1025,9 @@ async fn get_or_head_handler_inner( resp.headers_mut() .insert(header::LAST_MODIFIED, lm.parse().unwrap()); } + // Go sets ETag before conditional checks, so 304 includes it + resp.headers_mut() + .insert(header::ETAG, etag.parse().unwrap()); return resp; } }