Skip to content

fix: use HTTP/1.1 for cleartext requests through a forward proxy - #1578

Open
jlouvel wants to merge 3 commits into
fix/netty-non-proxy-hostsfrom
fix/netty-http2-forward-proxy
Open

jlouvel wants to merge 3 commits into
fix/netty-non-proxy-hostsfrom
fix/netty-http2-forward-proxy

Conversation

@jlouvel

@jlouvel jlouvel commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

Closes #1571. Based on #1577.

With httpClientTransportMode=HTTP2, the Netty client sent the HTTP/2 connection preface (prior knowledge) to the forward proxy for http:// requests. HTTP proxies such as Squid and most corporate proxies only speak HTTP/1.1 to clients, so these requests failed.

Changes

  • NettyClientHelper: cleartext connections to a forward proxy now use HTTP/1.1 with absolute-form request targets, and this is logged at FINE level. initConnection() now gets the proxy for both schemes and decides between tunnel and forward proxy itself. HTTPS requests through CONNECT tunnels still negotiate HTTP/2 with ALPN. The httpClientTransportMode Javadoc is updated.
  • ProxyTestCase: a request in HTTP2 mode through the forward proxy.
  • changes.md: entry under Bugs fixed.

I chose falling back over failing fast. HTTP2 mode is described as "HTTP/2 only", but a request that cannot work at all is less useful than one going out over HTTP/1.1, and DYNAMIC already behaves this way for cleartext.

Validation

ProxyTestCase (11 tests) and the Http2* connector tests pass.

🤖 Generated with Claude Code

In the HTTP2 transport mode, the Netty client sent the HTTP/2 connection
preface (prior knowledge) to the forward proxy for http:// requests. HTTP
proxies generally only speak HTTP/1.1 to clients, so these requests
failed.

- NettyClientHelper: cleartext connections to a forward proxy use
  HTTP/1.1 with absolute-form request targets, logged at FINE level.
  HTTPS requests through CONNECT tunnels still negotiate HTTP/2 with ALPN.
- ProxyTestCase: HTTP2 mode request through the forward proxy.

Closes #1571.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jerome Louvel <374450+jlouvel@users.noreply.github.com>
@jlouvel

jlouvel commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator Author

Full module verify passed at the top of the stack (#1580 branch, which includes this PR): 2,228 tests, 0 failures; JaCoCo checks met; SpotBugs 8 findings (threshold 9).

@sonarqubecloud

Copy link
Copy Markdown

@jlouvel
jlouvel requested a balanced review from Copilot October 30, 2026 14:52
@jlouvel jlouvel self-assigned this Oct 30, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No active review issues remain for the proxy-specific HTTP/1.1 fallback.

No open issues 🎉

What changed in this PR

Fixes #1571 by making the Netty client use HTTP/1.1 for cleartext requests through a forward proxy in HTTP2 mode, while preserving HTTP/2 negotiation for HTTPS through CONNECT tunnels.

Changes:

  • Adds the forward-proxy fallback with FINE-level logging and documents the exception to HTTP2 mode.
  • Adds a regression test verifying HTTP/1.1 forwarding with an absolute-form request target.
  • Records the fix in the changes log.
File Description
org.restlet/​src/​test/​java/​org/​restlet/​engine/​connector/​ProxyTestCase.java Tests cleartext forwarding in HTTP2 mode.
org.restlet/​src/​main/​java/​org/​restlet/​engine/​netty/​NettyClientHelper.java Implements and documents the proxy-specific HTTP/1.1 fallback.
changes.md Adds the bug-fix entry for #1571.

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants