简体   繁体   中英

Set http_proxy environment variable with domain user and pass in windows

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.

I'm using Windows 8.1 in which proxy settings are already set to

Address = proxy01.company.com

Port = 8080 .

my system is inside company.com domain, so:

my domain username is company\\B.amini

and my domain password is 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 .

Question:

Now, based on above information, my question is:

  1. What might be the reason of request timeout when pinging proxy address?

  2. Are proxy credentials the same as domain credentials?

  3. what is the correct way of setting http_proxy variable in command prompt?

I've tried many variations including:

Set http_proxy=http://company%5CB.amini:BA%40123@192.168.39.21:8080
Set http_proxy=http://B.amini:BA%40123@192.168.39.21:8080
Set http_proxy=company%5CB.amini:BA%40123@proxy01.company.com:8080
Set http_proxy=B.amini:BA%40123@proxy01.company.com: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:

HTTP/1.1 407 Proxy Authentication Required ( Forefront TMG requires authorizatio n to fulfill the request. Access to the Web Proxy filter is denied. )

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

  1. 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).

  2. 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.

  3. http_proxy variable for what? Browsers don't use environment variables for proxy config.

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.

Use %40 in place of @ in the password. It works!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM