feat(server): add response identity headers #20268
All Vouch review confidence checks passed
Residual risk 0.22 = Change Risk (0.52) × (1 − Review Confidence (0.57)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #20268"
general
weight: 0.35
GWphua
Description
This PR adds opt-in response headers that identify the Druid process which generated an HTTP response:
X-Druid-Server: advertised host and portX-Druid-Service: configureddruid.servicenameX-Druid-Version: Druid versionThe feature is disabled by default and can be enabled with:
The identity handler wraps the complete Jetty handler chain and restores the headers after downstream response resets, so locally generated responses, including early HTTP errors, receive the headers when enabled.
Proxy behavior
For query and management requests proxied by a Router:
Treating the three headers as an all-or-nothing triple prevents clients from receiving an ambiguous partial identity.
The standalone Coordinator's
/druid/indexer/*proxy to a separate Overlord follows the same contract, so it forwards a complete Overlord identity without mixing it with the Coordinator identity.Security
The headers can reveal internal hostnames, IP addresses, ports, and the Druid version. The setting remains disabled by default and should only be enabled when clients are authorized to receive this information.
Automated tests
ResponseIdentityHeaderTest: 6 embedded end-to-end tests passed.git diff --checkpassed.Real nano cluster validation
The feature was tested against a locally built
apache-druid-39.0.0-SNAPSHOTnano-quickstart cluster. All 16 requests returned the expected status and complete identity triple.| URL | Request | Status |
X-Druid-Server|X-Druid-Service|X-Druid-Version||---|---|---:|---|---|---|
|
http://localhost:8888/status/health| Router health | 200 |localhost:8888|druid/router|39.0.0-SNAPSHOT||
http://localhost:8082/status/health| Broker health | 200 |localhost:8082|druid/broker|39.0.0-SNAPSHOT||
http://localhost:8081/status/health| Coordinator/Overlord health | 200 |localhost:8081|druid/coordinator|39.0.0-SNAPSHOT||
http://localhost:8083/status/health| Historical health | 200 |localhost:8083|druid/historical|39.0.0-SNAPSHOT||
http://localhost:8091/status/health| Middle Manager health | 200 |localhost:8091|druid/middleManager|39.0.0-SNAPSHOT||
http://localhost:8081/druid/coordinator/v1/isLeader| Coordinator API direct | 200 |localhost:8081|druid/coordinator|39.0.0-SNAPSHOT||
http://localhost:8888/druid/coordinator/v1/isLeader| Coordinator API via Router | 200 |localhost:8081|druid/coordinator|39.0.0-SNAPSHOT||
http://localhost:8081/druid/indexer/v1/isLeader| Overlord API direct | 200 |localhost:8081|druid/coordinator|39.0.0-SNAPSHOT||
http://localhost:8888/druid/indexer/v1/isLeader| Overlord API via Router | 200 |localhost:8081|druid/coordinator|39.0.0-SNAPSHOT||
http://localhost:8082/druid/v2/sql| SQL direct to Broker | 200 |localhost:8082|druid/broker|39.0.0-SNAPSHOT||
http://localhost:8888/druid/v2/sql| SQL via Router | 200 |localhost:8082|druid/broker|39.0.0-SNAPSHOT||
http://localhost:8082/druid/v2| Native query direct to Broker | 200 |localhost:8082|druid/broker|39.0.0-SNAPSHOT||
http://localhost:8888/druid/v2| Native query via Router | 200 |localhost:8082|druid/broker|39.0.0-SNAPSHOT||
http://localhost:8083/druid/v2| Native query direct to Historical | 200 |localhost:8083|druid/historical|39.0.0-SNAPSHOT||
http://localhost:8888/status/health| Router-generatedPATCHrejection | 405 |localhost:8888|druid/router|39.0.0-SNAPSHOT||
http://localhost:8888/not-a-druid-endpoint| Router-generated missing endpoint | 404 |localhost:8888|druid/router|39.0.0-SNAPSHOT|The nano configuration runs Coordinator and Overlord in one process on port
8081withdruid.service=druid/coordinator, so requests to Overlord endpoints correctly report that process identity.Release note
Druid can optionally return
X-Druid-Server,X-Druid-Service, andX-Druid-Versionon HTTP responses, allowing operators to identify the process and version that served a direct or Router-proxied request. Enable the feature withdruid.server.http.enableResponseIdentityHeaders=trueonly for clients permitted to receive cluster topology and version information.<hr>
##### Key changed/added classes in this PR
ResponseIdentityHeaderHandlerOverlordProxyServletAsyncManagementForwardingServletAsyncQueryForwardingServletResponseIdentityHeaderTest<hr>
This PR has: