使用域用户设置 http_proxy 环境变量并传入 windows
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/48473330/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Set http_proxy environment variable with domain user and pass in windows
提问by Bahman_Aries
I've read many posts about this topic but unfortunately haven't been able to resolve my issue.
I've been trying to set http_proxy
and https_proxy
environment variables in windows using command prompt to be able to access my company's web proxy.
我已经阅读了很多关于这个主题的帖子,但不幸的是还没有解决我的问题。我一直试图设置http_proxy
和https_proxy
使用命令提示符能够访问我公司的web代理服务器环境变量窗口。
I'm using Windows 8.1 in which proxy settings are already set to
我使用的是 Windows 8.1,其中代理设置已设置为
Address = proxy01.company.com
地址 = proxy01.company.com
Port = 8080
.
端口 = 8080
。
my system is inside company.com
domain, so:
我的系统在company.com
域内,所以:
my domain username is company\B.amini
我的域用户名是 company\B.amini
and my domain password is BA@123
我的域密码是 BA@123
It's worth mentioning that when I ping proxy01.company.com
, command prompt shows: Pinging tmg01.company.com [192.168.39.21]
and it gives request timeout
.
值得一提的是,当我 ping 时proxy01.company.com
,命令提示符显示:Pinging tmg01.company.com [192.168.39.21]
并且它给出了request timeout
.
Question:
题:
Now, based on above information, my question is:
现在,根据上述信息,我的问题是:
What might be the reason of
request timeout
when pinging proxy address?Are proxy credentials the same as domain credentials?
what is the correct way of setting
http_proxy
variable in command prompt?
request timeout
ping代理地址时可能是什么原因?代理凭据是否与域凭据相同?
http_proxy
在命令提示符中设置变量的正确方法是什么?
I've tried many variations including:
我尝试了许多变体,包括:
Set http_proxy=http://company%5CB.amini:BA%[email protected]:8080
Set http_proxy=http://B.amini:BA%[email protected]:8080
Set http_proxy=company%5CB.amini:BA%[email protected]:8080
Set http_proxy=B.amini:BA%[email protected]:8080
Set http_proxy=proxy01.company.com:8080
Set http_proxy=http://192.168.39.21:8080
But in all cases, running a command such as Curl www.google.com -I
gives the following error:
但在所有情况下,运行这样的命令Curl www.google.com -I
都会出现以下错误:
HTTP/1.1 407 Proxy Authentication Required ( Forefront TMG requires authorizatio n to fulfill the request. Access to the Web Proxy filter is denied. )
HTTP/1.1 407 需要代理身份验证(Forefront TMG 需要授权才能完成请求。拒绝访问 Web 代理过滤器。)
采纳答案by Adrien
It's common for hosts to not respond to ICMP echo, so ping will time out, it doesn't mean anything any more (it used to back in the day when everything responded).
Proxy credentials = Domain credentials? Maybe. Depends on whether the proxy is configured to use your domain accounts or not. Since it's TMG, I'd say that is very likely.
http_proxy variable for what? Browsers don't use environment variables for proxy config.
主机不响应 ICMP 回声是很常见的,所以 ping 会超时,它不再意味着任何东西(它曾经回到一切响应的那一天)。
代理凭据 = 域凭据?也许。取决于代理是否配置为使用您的域帐户。既然是 TMG,我会说这很有可能。
http_proxy 变量有什么用?浏览器不使用环境变量进行代理配置。
That error 407 is an auth challenge from the proxy. You won't get any further until you start providing credentials that the proxy will accept.
该错误 407 是来自代理的身份验证挑战。在您开始提供代理将接受的凭据之前,您将无法获得更多信息。
回答by Alejandro Mendoza
The isssue is the @ in your password, you should set like this:
问题是密码中的@,你应该这样设置:
setx http_proxy http://user:password@proxyIP:proxyPort/
Also its recomendable using setx for persistence
也推荐使用 setx 进行持久化
回答by ayush
Use %40 in place of @ in the password. It works!
在密码中使用 %40 代替 @。有用!