Skip to content

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

Merged
jlouvel merged 2 commits into
fix/netty-non-proxy-hostsfrom
fix/netty-http2-forward-proxy
Nov 1, 2026
Merged

jlouvel merged 2 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

@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).

@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

@jlouvel
jlouvel force-pushed the fix/netty-non-proxy-hosts branch from a3b9e8d to 599b447 Compare October 31, 2026 07:44
@jlouvel
jlouvel force-pushed the fix/netty-http2-forward-proxy branch from 1a8d097 to cb75355 Compare October 31, 2026 07:44
@jlouvel
jlouvel force-pushed the fix/netty-non-proxy-hosts branch from 599b447 to fac8722 Compare November 1, 2026 14:56
@jlouvel
jlouvel force-pushed the fix/netty-http2-forward-proxy branch from cb75355 to 9daac3e Compare November 1, 2026 14:56
jlouvel and others added 2 commits November 1, 2026 11:09
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 <[email protected]>
Signed-off-by: Jerome Louvel <[email protected]>
@jlouvel
jlouvel force-pushed the fix/netty-non-proxy-hosts branch from fac8722 to 2bd2e6f Compare November 1, 2026 16:18
@jlouvel
jlouvel force-pushed the fix/netty-http2-forward-proxy branch from 9daac3e to e46e56b Compare November 1, 2026 16:18
@sonarqubecloud

sonarqubecloud Bot commented Nov 1, 2026

Copy link
Copy Markdown

@jlouvel
jlouvel merged commit 0cfaa9b into fix/netty-non-proxy-hosts Nov 1, 2026
3 of 4 checks passed
@jlouvel
jlouvel deleted the fix/netty-http2-forward-proxy branch November 1, 2026 20:09
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