WinHttp Configuration for Windows Vista Beta 2 – Part 2


In Part 1 of this series I discussed the tools used to configure WinHttp today and introduced the changes happening for Windows Vista. In this post I’m looking at the Proxy settings. Again as a reminder, this is how it is for Windows Vista Beta 2 and it is likely to change some before Vista RTM.

After running netsh and going to the winhttp context, we switch to the proxy context by typing “proxy”:

netsh winhttp> proxy

netsh winhttp proxy>

 
 

Here is the list of available commands in that context:

netsh winhttp proxy>?

 
 

The following commands are available:

 
 


… (Skipping the inherited commands …)


 
 

Commands in this context:

?              – Displays a list of commands.

dump           – Displays a configuration script.

help           – Displays a list of commands.

import         – Imports proxy setting from IE.

reset          – Resets WinHTTP proxy setting to DIRECT.

set            – Configures WinHTTP proxy setting.

show           – Displays current WinHTTP proxy setting.

 
 

You can use “show” to view the current settings, “set” to set the proxy settings and “import” to import current user’s Internet Explorer proxy settings. If you’ve used proxycfg.exe you will find that this context provides the same functionality. The only exception is “dump”, which creates a Netsh script with the current settings and can be executed later (on the same machine or different one) to set those settings.

Let’s start by displaying the current proxy settings:

netsh winhttp proxy>show

 
 

Current WinHTTP proxy settings:

 
 

    Direct access (no proxy server).

 
 

Now let’s set the proxy server for HTTP sites to “myproxy” (port 80 by default), proxy server for HTTPS sites to “sproxy” (port 88) and set the bypass list to “*.foo.com”:

netsh winhttp proxy>set proxy-server=”http=myproxy;https=sproxy:88″ bypass-list=

“*.foo.com”


 

Current WinHTTP proxy settings:


 

Proxy Server(s) : http=myproxy;https=sproxy:88

Bypass List : *.foo.com


 

To reset the proxy settings to “direct” (not to use proxy servers), just type “reset”:

netsh winhttp proxy>reset


 

Current WinHTTP proxy settings:


 

Direct access (no proxy server).


 

Another useful command is to import the proxy settings for the current user in Internet Explorer (note that different users may specify different proxy settings in IE):

Current WinHTTP proxy settings:


 

Proxy Server(s) : ieproxy:80

Bypass List : <local>


 

Again, if you need to get a help on a command, just type it with question mark after it.

Next time I will go into a bit more detail about tracing configuration.

 –Nesho Neshev

Comments (7)

  1. In Part 1 and Part 2 of this series I discussed the tools used to configure WinHttp today, introduced…

  2. John Fratus says:

    Thanks for getting this documented somewhere. The Netsh stuff works fine as a replacement for Proxycfg. However in our production environment we use WPAD. I have this set up in the Connections settings in Vista IE7 and it’s working well there. But I can’t seem to get WinHTTP to recognize that. Is there any additional configuration needed?

  3. In Part 1, Part 2 and Part 3 of this series I discussed the tools used to configure WinHttp today, introduced…

  4. Nesho Neshev [MSFT] says:

    Thanks for your interest!

    Actually importing IE (including IE 7) proxy settings works only if IE is set to use a specific proxy. It doesn’t work if IE is set to automatically detect proxy settings or use an autoconfig URL.

    WinHttp applications can use WPAD, but they have to call WinHttpGetProxyForUrl to do the autoproxy lookup. This is an additional API call and is not controlled by the WinHttp settings.

  5. In my previous posts, I described the new WinHttp proxy , tracing and client certificate configuration