What Java properties to pass to a Java app to authenticate with a http proxy

后端 未结 3 1273
我在风中等你
我在风中等你 2021-01-19 18:53

I have a Java application that is trying to access a web service via http proxy. The Java app is 3rd party app for which we don\'t have access to source code.

Its la

3条回答
  •  广开言路
    2021-01-19 19:51

    One also needs to specify NT domain for NTLM authnetication to work.

    -Dhttp.proxyUser=MyDomain/username
    

    or by setting

    -Dhttp.auth.ntlm.domain=MyDomain
    

    And you also MUST explicitly instruct HttpClient to take system properties into account, which it does not do by default

     CloseableHttpClient client = HttpClients.createSystem();
    

    or

     CloseableHttpClient client = HttpClients.custom()
         .useSystemProperties()
         .build();
    

提交回复
热议问题