All Articles

old proxy tunneling issue with java

So you happen to work in an environment where you’re behind a proxy. Not a big deal you might think, a bit annoying, yes. Until the moment when you run e.g. the gradle wrapper and hits you back with a

Exception in thread "main" Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy 
Authentication Required"

exception. But surely you have configured everything correctly, including the proxy authentication. You never had this before, but then again you were never before behind an authenticated proxy. You run curl against the same address to get the distribution with those exact proxy settings and it just works!

There’s a simple explanation for that: since jdk8u111 Basic authentication for https tunneling is not allowed. To override this for gradle you may pass systemProp.jdk.http.auth.tunneling.disabledSchemes="" to More generally you can pass/configure jdk.http.auth.tunneling.disabledSchemes jvm property to empty or remove Basic if already there, or do it globally in of jre/lib.