最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Is there a way to configure proxy based on hostname in PoolingHttpClientConnectionManager httpclient5 - Stack Overflow

programmeradmin0浏览0评论

I am trying to configure my spring restclient in a way that if hostname has "internal" in its name then do not go via proxy and if it is something else then go via proxy. We are currently achieving it using two different restclients one having proxy configuration and one do not have.

HttpHost proxy = new HttpHost("someproxy", 8080);
DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy);
CloseableHttpClient httpclient = HttpClients.custom()
        .setRoutePlanner(routePlanner)
        .build();

Can we achieve it in the same restclient?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论