janhoy commented on code in PR #4574:
URL: https://github.com/apache/solr/pull/4574#discussion_r3504545535
##########
solr/core/src/java/org/apache/solr/servlet/HttpSolrProxy.java:
##########
@@ -41,15 +41,19 @@
class HttpSolrProxy {
// TODO add X-Forwarded-For and with comma delimited
- private static final Set<HttpHeader> HOP_BY_HOP_HEADERS =
+ // Headers not to forward: hop-by-hop, plus Host and Content-Length which
the Jetty client
+ // re-derives for the upstream. Forwarding the originals makes Jetty 12.1
reject with a 400.
+ private static final Set<HttpHeader> SKIP_HEADERS =
EnumSet.of(
HttpHeader.CONNECTION,
HttpHeader.KEEP_ALIVE,
HttpHeader.PROXY_AUTHENTICATE,
HttpHeader.PROXY_AUTHORIZATION,
HttpHeader.TE,
HttpHeader.TRANSFER_ENCODING,
- HttpHeader.UPGRADE);
+ HttpHeader.UPGRADE,
+ HttpHeader.HOST,
+ HttpHeader.CONTENT_LENGTH);
Review Comment:
From Claude research:
solr/core/src/java/org/apache/solr/servlet/HttpSolrProxy.java:143-150,
copyResponseHeaders() blindly copies the upstream Content-Length onto the
client-facing response, then re-streams the body through its own 8 KB buffer
(onContent, lines 95-111). When the re-framed byte count doesn't match the
copied Content-Length, 12.1 aborts the same way — producing the 400/EOF the
test sees.
What should be done: treat Content-Length like the hop-by-hop headers the
proxy already strips — i.e. add HttpHeader.CONTENT_LENGTH to the skip set in
copyResponseHeaders (and arguably in copyRequestHeaders) so the container
computes framing itself. The proxy shouldn't forward a length it isn't going to
reproduce byte-for-byte.
--
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]