无法通过代理隧道。代理返回HTTP / 1.1 503服务不可用 [英] Unable to tunnel through proxy. Proxy returns HTTP/1.1 503 Service Unavailable
问题描述
我想连接到Intranet服务器,我需要连接的网址是:
I want to connect to an intranet server, the url that I need to connect is:
URLConnection conn = new URL("https://mywebsite").openConnection();
当我通过以下方式调用connect方法时:`
When I reach to the connect method call through:`
conn.connect();
我收到以下异常:
java.io.IOException: Unable to tunnel through proxy. Proxy rerurns HTTP/1.1 503 Service Unavailable"
at sun.net.www.protocol.httpHttpURLConnection.doTunneling
我如何解决这个例外,我尝试过在网上发布的许多解决方案,但没有任何运气。
How can I solve this exception, I have tried many solutions published on the net, but without any luck.
推荐答案
对我有帮助的是取消设置环境中的所有代理属性( http_proxy
等env变量; java属性如 -Dhttp.proxyHost = ..
令人惊讶地没有效果。)我的网址( https://mycompany.example。 com / service )可直接访问(因为它位于内部网络上),但不能通过代理访问。
What helped to me was to unset all proxy properties in the environment (http_proxy
etc env variables; java properties such as -Dhttp.proxyHost=..
had, surprisingly, no effect). My URL (https://mycompany.example.com/service) was accessible directly (because it was on the internal network) but not through the proxy.
因此请检查服务所在的位置并检查与代理相关的环境变量。
So check where the service lives and check for proxy-related environment variables.
这篇关于无法通过代理隧道。代理返回HTTP / 1.1 503服务不可用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!