6

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

Bahman_Aries
  • 4,658
  • 6
  • 36
  • 60

3 Answers3

8

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

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

Adrien
  • 1,061
  • 8
  • 11
  • Thanks for your answer. You mentioned "Browsers don't use environment variables" and also "provide credentials that the proxy will accept". So, What Browsers do use? and assuming I know the correct credentials, how can I provide them in a way that proxy will accept? – Bahman_Aries Jan 31 '18 at 11:51
  • web browsers typically use several different methods for proxy. It's common for a browser to by default do proxy auto-detection to find a proxy by various discovery methods (DHCP and/or DNS). It's also common for AD admins to push out proxy config using group policy. In Windows, browser proxy configuration tends to be stored in the windows registry. – Adrien Feb 01 '18 at 21:47
  • As for credentials, if the proxy is challenging for auth and offering NTLM or Negotiate methods (proxy config), then the browser will usually automatically try the current logged in user credentials without bothering the person, otherwise a login dialog will be popped up. – Adrien Feb 01 '18 at 21:48
2

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

ayush
  • 21
  • 1