Skip to content

feat: bypass the proxy for the hosts listed in nonProxyHosts - #1577

Open
jlouvel wants to merge 2 commits into
fix/netty-https-proxy-propertiesfrom
fix/netty-non-proxy-hosts
Open

jlouvel wants to merge 2 commits into
fix/netty-https-proxy-propertiesfrom
fix/netty-non-proxy-hosts

Conversation

@jlouvel

@jlouvel jlouvel commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #401. Based on #1575.

When a proxy was configured, the Netty client sent every request through it, including requests to localhost and internal hosts.

Changes

  • NettyClientHelper:
    • New nonProxyHosts connector parameter, falling back to the http.nonProxyHosts system property. It uses the JDK syntax: host names separated by |, each with an optional leading or trailing * wildcard, matched ignoring case. As in the JDK, the list applies to both HTTP and HTTPS requests.
    • New public getNonProxyHosts(). getProxy(secure, targetHost) now returns null for matching hosts, so these requests use origin-form request lines, connect directly, and are not tunneled.
    • The parameter table Javadoc is updated.
  • NettyClientCall: the tunnel check passes the target host.
  • ProxyTestCase: loopback hosts bypassed by default, bypass with the parameter (with spaces and mixed case) and with the system property over HTTPS, and other hosts still proxied, including a check that local doesn't match localhost.
  • changes.md: entry under Enhancements.

Loopback default

As with the JDK, when neither the parameter nor http.nonProxyHosts is set, the loopback addresses are excluded by default: localhost|127.*|[::1]|0.0.0.0|[::0]. An empty value excludes no host, as in the JDK. This is a small behavior change: a client with a proxy configured now connects directly to localhost. The proxy tests set nonProxyHosts to an empty string so they can still use a test proxy on localhost.

Validation

ProxyTestCase: 11 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 and others added 2 commits October 31, 2026 03:22
When a proxy was configured, the Netty client sent every request through
it, including requests to localhost and internal hosts.

- NettyClientHelper: new "nonProxyHosts" parameter, defaulting to the
  "http.nonProxyHosts" system property, with the JDK syntax: host names
  separated by "|", with an optional leading or trailing "*" wildcard,
  matched ignoring case. It applies to HTTP and HTTPS requests. Unlike
  the JDK, no host is excluded by default.
- ProxyTestCase: parameter and system property bypass, other hosts still
  proxied.

Closes #401.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Jerome Louvel <374450+jlouvel@users.noreply.github.com>
As with the JDK, nonProxyHosts defaults to localhost|127.*|[::1]|0.0.0.0|[::0]
when neither the parameter nor the http.nonProxyHosts system property is set.
An empty value excludes no host.

Refs #401

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jlouvel
jlouvel force-pushed the fix/netty-non-proxy-hosts branch from a3b9e8d to 599b447 Compare October 31, 2026 07:44
@sonarqubecloud

Copy link
Copy Markdown

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.

1 participant