Hi All, After updating an app from HC Core 5.2.5 to 5.3, my custom version of
https://github.com/apache/httpcomponents-core/blob/master/httpcore5-h2/src/test/java/org/apache/hc/core5/http2/examples/H2FileServerExample.java started failing tests because it is replying with a HTTP status 421 instead of 200. Narrowing down the Core versions, 5.3-alpha2 was OK and the failure started in 5.3-beta1. I test this app with 2 different clients, Jetty 12 (12.0.14-SNAPSHOT) and HttpClient 5.3.1. The app flow is: - HC HTTP Client <-> Jetty 12 org.eclipse.jetty.ee9.proxy.AsyncMiddleManServlet (a custom subclass) <-> Custom H2FileServerExample - Jetty HTTP Client <-> Jetty 12 org.eclipse.jetty.ee9.proxy.AsyncMiddleManServlet (a custom subclass) <-> Custom H2FileServerExample Both Jetty and HC clients see the 421 come back from AsyncMiddleManServlet. This is a hint that something changed in Core since this is what H2FileServerExample uses. It turns out that the problem is that the client sends request to "localhost" and the H2FileServerExample’s AsyncServerBootstrap ends up using InetAddress.getLocalHost().getCanonicalHostName() which replies "host.docker.internal" on my machine and not “localhost”, so the Core issues a 421 on behalf of H2FileServerExample. If I change the test clients to send requests to "host.docker.internal" instead of "localhost", it still fails with a 421. In the file server, these are the headers we get from the AsyncMiddleManServlet: [Accept-Encoding: gzip, x-gzip, deflate, User-Agent: Apache-HttpClient/5.3.1 (Java/17.0.12), Via: 1.1 MY_COMPANY_COMPUTER_NAME, X-Forwarded-For: 192.168.1.2, X-Forwarded-Proto: http, X-Forwarded-Host: host.docker.internal:60975, X-Forwarded-Server: 192.168.1.2, x-header-a: a1, Host: localhost:60974] So I updated the configuration of my AsyncMiddleManServlet subclass to use getCanonicalHostName(). Now, it all works. My question is: Did 5.3 become stricter and that is undocumented in the release notes, or, is this a regression? TY, Gary --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org