Version
From 5.2.53 ?
Allow setup for alternative proxy added to JVM properties for some urls (altProxyHost/Port/Urls).
JAVA_OPTS=-Dhttp.proxyHost=app-proxy... -Dhttp.proxyPort=80 -Dhttps.proxyHost=app-proxy... -Dhttps.proxyPort=80 -Dhttp.altProxyHost=alt-proxy...-Dhttp.altProxyPort=80 -Dhttps.altProxyHost=alt-proxy... -Dhttps.altProxyPort=80 -DaltProxyUrls=... -Dhttp.nonProxyHosts=169.254.169.254\|metadata.google.internal\|localhost\|127.0.0.1
Description
ProxySelector.setDefault(
new ProxySelector() {
final ProxySelector delegate = ProxySelector.getDefault();
@Override
public List<Proxy> select(URI uri) {
if (System.getProperty("https.altProxyHost") != null && System.getProperty("https.altProxyPort") != null) {
if (uri.toString().contains("gitlabee.dt") && uri.toString().contains("https://")) {
AppLog.warning("Override default https proxy for gitlabee.dt destination", null, Grant.getSystemAdmin());
return Arrays.asList(new Proxy(Type.HTTP, InetSocketAddress.createUnresolved(
System.getProperty("https.altProxyHost"),
Integer.parseInt(System.getProperty("https.altProxyPort"))
)));
}
}
if (System.getProperty("http.altProxyHost") != null && System.getProperty("http.altProxyPort") != null) {
if (uri.toString().contains("gitlabee.dt") && uri.toString().contains("http://")) {
AppLog.warning("Override default http proxy for gitlabee.dt destination", null, Grant.getSystemAdmin());
return Arrays.asList(new Proxy(Type.HTTP, InetSocketAddress.createUnresolved(
System.getProperty("http.altProxyHost"),
Integer.parseInt(System.getProperty("http.altProxyPort"))
)));
}
}
return delegate == null ? Arrays.asList(Proxy.NO_PROXY) : delegate.select(uri);
}
@Override
public void connectFailed(URI uri, SocketAddress sa, IOException e) {
if (uri == null || sa == null || e == null) throw new IllegalArgumentException("Arguments can not be null.");
}
}
);