You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iggy.apache.org by hg...@apache.org on 2026/10/18 15:34:27 UTC
(iggy) 09/23: fix(server-ng): omit X-Iggy-View on error responses
This is an automated email from the ASF dual-hosted git repository.
hubcio pushed a commit to branch http-listener
in repository https://gitbox.apache.org/repos/asf/iggy.git
commit df449cd0f7e5fa0f1b09a792175ca410e87853c9
Author: Hubert Gruszecki <h....@gmail.com>
AuthorDate: Thu Jul 2 18:23:40 2026 +0200
fix(server-ng): omit X-Iggy-View on error responses
The view header was attached by the outermost response layer
unconditionally, so pre-auth rejections leaked the cluster-internal
view number to anonymous callers. Attach it only to success and
redirect responses; the 307 primary-redirect contract is unaffected.
---
core/server-ng/src/http.rs | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/core/server-ng/src/http.rs b/core/server-ng/src/http.rs
index 53931ca46..c98318633 100644
--- a/core/server-ng/src/http.rs
+++ b/core/server-ng/src/http.rs
@@ -2876,10 +2876,16 @@ fn self_node_metadata(roster: &ClusterRoster) -> ClusterMetadata {
}
}
-/// Set the [`VIEW_HEADER`] to the current VSR view on `response`. Omits the
-/// header when this node has no live consensus: a missing header is
-/// unambiguous, whereas a fabricated view number would mislead.
+/// Set the [`VIEW_HEADER`] to the current VSR view on a successful or redirect
+/// `response`. Omits the header on error responses and when this node has no
+/// live consensus: a missing header is unambiguous, whereas a fabricated view
+/// number would mislead.
fn insert_view_header(state: &HttpInner, mut response: Response) -> Response {
+ // The view is cluster-internal; error responses (notably pre-auth 401s)
+ // must not leak it. Success and the 307 primary-redirect still carry it.
+ if !(response.status().is_success() || response.status().is_redirection()) {
+ return response;
+ }
if let Some(consensus) = state.shard.plane.metadata().consensus.as_ref() {
response
.headers_mut()