[
https://issues.apache.org/jira/browse/CXF-9218?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=18084117#comment-18084117
]
Freeman Yue Fang commented on CXF-9218:
---------------------------------------
Thanks for reporting this issue [~pretzer]!
When no custom ProxySelector is installed, ProxySelector.getDefault() is
DefaultProxySelector, which already reads http.proxyHost, http.proxyPort, and
http.nonProxyHosts internally — same semantics as before. So I think we can
simply remove systemProxyConfiguration entirely and have getSystemProxy()
delegate to ProxySelector.getDefault(). This way we can both honour the custom
ProxySelector and keep backwards compatible.
Freeman
> 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
> Priority: Major
>
> 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)