Matthias Pretzer created CXF-9218:
-------------------------------------
Summary: Respect configured ProxySelector instead of hard-wiring
system proxy properties
Key: CXF-9218
URL: https://issues.apache.org/jira/browse/CXF-9218
Project: CXF
Issue Type: Improvement
Components: Transports
Affects Versions: 4.2.1
Reporter: Matthias Pretzer
h3. Problem
{{org.apache.cxf.transport.http.ProxyFactory.systemProxyConfiguration}}
currently bypasses the JVM's configured {{ProxySelector}} and directly reads
the standard proxy system properties ({{http.proxyHost}} etc.)
This prevents applications from using a custom {{ProxySelector}} implementation
together with the standard JVM proxy configuration.
h3. Our use case
We configure the standard JVM proxy properties as usual ({{http.proxyHost}},
...)
In addition, we wrap {{sun.net.spi.DefaultProxySelector}} with our own custom
{{ProxySelector}} in order to selectively bypass the proxy for specific hosts.
However, because {{systemProxyConfiguration}} directly evaluates the system
properties, our configured {{ProxySelector}} is never invoked.
h3. Expected behavior
If a custom {{ProxySelector}} is configured via
{{ProxySelector.setDefault(...)}}, CXF should preferably respect that selector
instead of directly evaluating the proxy system properties.
This would allow applications to implement:
* selective proxy bypass
* policy-based routing
* dynamic proxy decisions
* logging / observability around proxy selection
while still relying on the standard JVM proxy configuration.
h3. Suggestion
Possible options:
* Prefer {{ProxySelector.getDefault()}} over direct system property evaluation
* Deprecate {{systemProxyConfiguration}}
* Introduce a configuration flag that allows opting into
{{ProxySelector}}-based resolution
This would improve compatibility with modern JVM proxy customization mechanisms
while remaining backwards compatible.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)