{"action":"created","issue":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/792","labels_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/792/labels{/name}","comments_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/792/comments","events_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/792/events","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/792","id":53623046,"number":792,"title":"How to do digest authentication  on  proxy server with AHC ","user":{"login":"weiliangwei","id":8870018,"avatar_url":"https://avatars.githubusercontent.com/u/8870018?v=3","gravatar_id":"","url":"https://api.github.com/users/weiliangwei","html_url":"https://github.com/weiliangwei","followers_url":"https://api.github.com/users/weiliangwei/followers","following_url":"https://api.github.com/users/weiliangwei/following{/other_user}","gists_url":"https://api.github.com/users/weiliangwei/gists{/gist_id}","starred_url":"https://api.github.com/users/weiliangwei/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weiliangwei/subscriptions","organizations_url":"https://api.github.com/users/weiliangwei/orgs","repos_url":"https://api.github.com/users/weiliangwei/repos","events_url":"https://api.github.com/users/weiliangwei/events{/privacy}","received_events_url":"https://api.github.com/users/weiliangwei/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/labels/Defect","name":"Defect","color":"e11d21"},{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/labels/Netty","name":"Netty","color":"009800"}],"state":"open","locked":false,"assignee":{"login":"slandelle","id":849197,"avatar_url":"https://avatars.githubusercontent.com/u/849197?v=3","gravatar_id":"","url":"https://api.github.com/users/slandelle","html_url":"https://github.com/slandelle","followers_url":"https://api.github.com/users/slandelle/followers","following_url":"https://api.github.com/users/slandelle/following{/other_user}","gists_url":"https://api.github.com/users/slandelle/gists{/gist_id}","starred_url":"https://api.github.com/users/slandelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slandelle/subscriptions","organizations_url":"https://api.github.com/users/slandelle/orgs","repos_url":"https://api.github.com/users/slandelle/repos","events_url":"https://api.github.com/users/slandelle/events{/privacy}","received_events_url":"https://api.github.com/users/slandelle/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/milestones/36","labels_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/milestones/36/labels","id":928735,"number":36,"title":"1.9.5","description":"","creator":{"login":"slandelle","id":849197,"avatar_url":"https://avatars.githubusercontent.com/u/849197?v=3","gravatar_id":"","url":"https://api.github.com/users/slandelle","html_url":"https://github.com/slandelle","followers_url":"https://api.github.com/users/slandelle/followers","following_url":"https://api.github.com/users/slandelle/following{/other_user}","gists_url":"https://api.github.com/users/slandelle/gists{/gist_id}","starred_url":"https://api.github.com/users/slandelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slandelle/subscriptions","organizations_url":"https://api.github.com/users/slandelle/orgs","repos_url":"https://api.github.com/users/slandelle/repos","events_url":"https://api.github.com/users/slandelle/events{/privacy}","received_events_url":"https://api.github.com/users/slandelle/received_events","type":"User","site_admin":false},"open_issues":1,"closed_issues":6,"state":"open","created_at":"2015-01-09T15:21:22Z","updated_at":"2015-01-12T14:54:50Z","due_on":"2015-01-15T23:00:00Z","closed_at":null},"comments":11,"created_at":"2015-01-07T11:30:07Z","updated_at":"2015-01-12T15:00:35Z","closed_at":null,"body":" 1. I used  AHC version 1.9 and netty 3.\r\nMy code  is  following :\r\n```java\r\n//DIGEST authentication : username and password\r\nProxyServer  p=new ProxyServer(\"192.168.20.189\", 80,\"userTest\",\"123456\");\r\n\r\nAsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setProxyServer(p).build();\r\n\r\nAsyncHttpClient client = new AsyncHttpClient(new NettyAsyncHttpProvider(config), config);\r\n\r\nRealm realm = new Realm.RealmBuilder()\r\n  .setPrincipal(\"userTest\")\r\n  .setPassword(\"123456\")\r\n  .setUsePreemptiveAuth(true)\r\n  .setScheme(AuthScheme.DIGEST)\r\n  .setTargetProxy(true) .build();\t\r\n\t\t\r\nListenableFuture<Response>  a=client.prepareGet(\"http://www.baidu.com\").setRealm(realm).setProxyServer(p).execute();\r\nSystem.out.println(a.get().getResponseBody().toString());//will return  401 code.\r\n```\r\n\r\n2  . I want to access \"http://www.baidu.com\" by the nginx server ( nginx as a proxy server) ,and  do digest authentication ( nginx has plugin whose name is 'nginx-http-auth-digest' )on the same nginx server. So the Nginx server has two fuctions :\r\nproxy  and do digest authentication .If authentication passed, the proxy will process the request .Others return 401 code.\r\n\r\n3.By the way ,The  target website \"http://www.baidu.com\" which I want to access  does not need digest authentication. Digest authentication progressing is  on the nginx server .\r\nI want to make every requst  do digest  authentication on the nginx  server and the nginx server could also proxy every  request  normally at the same time if digest authentication  passed  .\r\n\t \r\n4.So  I have two questions :\r\n4.1.Could I think the AHC support digest authentication on proxy? \r\n4.2.If it support digest authentication on proxy , how to change my code ? Or Could you give me an example ? "},"comment":{"url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/comments/69581876","html_url":"https://github.com/AsyncHttpClient/async-http-client/issues/792#issuecomment-69581876","issue_url":"https://api.github.com/repos/AsyncHttpClient/async-http-client/issues/792","id":69581876,"user":{"login":"slandelle","id":849197,"avatar_url":"https://avatars.githubusercontent.com/u/849197?v=3","gravatar_id":"","url":"https://api.github.com/users/slandelle","html_url":"https://github.com/slandelle","followers_url":"https://api.github.com/users/slandelle/followers","following_url":"https://api.github.com/users/slandelle/following{/other_user}","gists_url":"https://api.github.com/users/slandelle/gists{/gist_id}","starred_url":"https://api.github.com/users/slandelle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/slandelle/subscriptions","organizations_url":"https://api.github.com/users/slandelle/orgs","repos_url":"https://api.github.com/users/slandelle/repos","events_url":"https://api.github.com/users/slandelle/events{/privacy}","received_events_url":"https://api.github.com/users/slandelle/received_events","type":"User","site_admin":false},"created_at":"2015-01-12T15:00:35Z","updated_at":"2015-01-12T15:00:35Z","body":"Closed as of #800, #801, #802 and #803.\r\n\r\nexample:\r\n\r\n```java\r\nProxyServer p = new ProxyServer(\"119.57.47.14\", 3128, \"userTest\", \"123456\");\r\np.setScheme(AuthScheme.DIGEST);\r\n\r\nAsyncHttpClientConfig config = new AsyncHttpClientConfig.Builder().setProxyServer(p).build();\r\n\r\nAsyncHttpClient asyncHttpClient = new AsyncHttpClient(new NettyAsyncHttpProvider(config), config);\r\ntry {\r\n    ListenableFuture<Response> a = asyncHttpClient.prepareGet(\"http://www.baidu.com\").setProxyServer(p).execute();\r\n    System.out.println(a.get().getStatusCode());\r\n\r\n} finally {\r\n    asyncHttpClient.close();\r\n}\r\n```"}}