capistrant commented on code in PR #18424:
URL: https://github.com/apache/druid/pull/18424#discussion_r2345033125


##########
server/src/main/java/org/apache/druid/server/initialization/jetty/StandardResponseHeaderFilterHolder.java:
##########
@@ -66,16 +66,17 @@ public StandardResponseHeaderFilterHolder(final 
ServerConfig serverConfig)
    * Remove any standard headers in proxyResponse if they were also set in the 
origin response, serverResponse.
    * This prevents duplicates headers from appearing in proxy responses.
    *
-   * Used by implementations of {@link 
org.eclipse.jetty.proxy.AsyncProxyServlet}.
+   * Used by implementations of {@link 
org.eclipse.jetty.ee8.proxy.AsyncProxyServlet}.
    */
   public static void deduplicateHeadersInProxyServlet(
       final HttpServletResponse proxyResponse,
       final Response serverResponse
   )
   {
     for (final String headerName : 
StandardResponseHeaderFilterHolder.STANDARD_HEADERS) {
-      if (serverResponse.getHeaders().containsKey(headerName) && 
proxyResponse.containsHeader(headerName)) {
-        ((org.eclipse.jetty.server.Response) 
proxyResponse).getHttpFields().remove(headerName);
+      if (serverResponse.getHeaders().contains(headerName) && 
proxyResponse.containsHeader(headerName)) {
+        // In Jetty 12 EE8, use the standard servlet API method to remove 
headers
+        proxyResponse.setHeader(headerName, null);

Review Comment:
   I did some testing here and found that this approach is indeed removing the 
duplicate headers from proxied requests.. I tested locally with and without 
this set to null and without it, the headers in the constant are duplicated. I 
think this is a bit of a gray area in the servlets api, which has the copilot 
bot on high alert.



-- 
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