我正在尝试通过经过身份验证的代理发出请求,如下所示
<div class="sliders">
<label for="name1">John</label><input id="name1" type="range" min="0" max="1.0" step="0.01" />
<label for="name2">Jacob</label><input id="name2" type="range" min="0" max="1.0" step="0.01" />
<label for="name3">Jingleheimer</label><input id="name3" type="range" min="0" max="1.0" step="0.01" />
<label for="name4">Schmidt</label><input id="name4" type="range" min="0" max="1.0" step="0.01" />
</div>
我的问题是它给了我以下错误,我不太明白。我怀疑我可能没有使用正确的类来进行身份验证。
HttpHost proxy = new HttpHost("http-proxy", 80);
CredentialsProvider credsProvider = new BasicCredentialsProvider();
credsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials(
user, password));
try (CloseableHttpClient client = HttpClientBuilder.create().setDefaultCredentialsProvider(credsProvider)
.build()) {
HttpPost post = new HttpPost(url);
RequestConfig config = RequestConfig.custom().setProxy(proxy).build();
post.setConfig(config);
post.setEntity(new UrlEncodedFormEntity(urlParameters));
HttpResponse response = client.execute(post);
return response;
}
答案 0 :(得分:0)
似乎MS代理服务器配置有问题。您可以disable NTLM in HTTP client尝试基本身份验证,或者如果必须使用NTLM / Kerberos,请尝试HTTP wire logs以进一步解决问题。