FrankChen021 commented on code in PR #20268:
URL: https://github.com/apache/druid/pull/20268#discussion_r3940962558


##########
services/src/main/java/org/apache/druid/server/AsyncQueryForwardingServlet.java:
##########
@@ -634,6 +635,10 @@ protected void onServerResponseHeaders(
     if (responseContext != null) {
       proxyResponse.setHeader(responseContext.getName(), 
responseContext.getValue());
     }
+    // When response identity headers are enabled, the outer response handler 
initially adds the Router identity.
+    // An upstream response must replace it with the upstream identity, or 
with no identity when the upstream does not
+    // provide a complete header triple.
+    ResponseIdentityHeaderHandler.clearRouterIdentity(proxyResponse);

Review Comment:
   Fixed in cb191b827f. Each proxy now remembers its local identity before 
replacing it with upstream headers and restores that local triple in 
onProxyResponseFailure before Jetty generates the 502/504. The same handling is 
applied to query forwarding, management forwarding, and the legacy 
Coordinator-to-Overlord proxy. The shared remember/restore behavior has focused 
unit coverage.



##########
server/src/main/java/org/apache/druid/server/initialization/jetty/JettyServerModule.java:
##########
@@ -404,6 +404,9 @@ public void lifeCycleStopped(LifeCycle event)
     JettyServerInitializer initializer = 
injector.getInstance(JettyServerInitializer.class);
     try {
       initializer.initialize(server, injector);
+      if (config.isEnableResponseIdentityHeaders()) {
+        server.setHandler(new ResponseIdentityHeaderHandler(node, 
server.getHandler()));

Review Comment:
   Fixed in cb191b827f. Response identity headers are now also added through 
the Jetty server error-handler path, which covers request-line and header 
parsing failures that never enter the application handler chain. I added an 
embedded raw-socket test that sends an invalid HTTP header and verifies the 
resulting 400 response contains the Router server, service, and version 
identity.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to