<html>
<head>
<title>How to detect proxy server automatically</title>
<LINK REL="stylesheet" TYPE="text/css" HREF="../../css0.css">
</head>
<body>

<!--#include virtual="/doc/header.html" -->

<p align=right>Last Updated on 14 Feb 2004</p>

<h1>How to detect proxy server automatically</h1>
<p>If you have many number of computers in your LAN and sharing the internet, you should prepare a proxy server and cache the internet object to improve the access speed. Then all computer need to point the proxy server, but it's a heavy job for the network administrator to open all browser and point to the proxy server manually.</p>
<p>If you are using Linux as a gateway, you can configure it as a transparent proxy, then all http packets can be redirected to proxy server transparently. But windows 2000 server can not function as the transparent proxy.</p>
<p>Windows 2000 Server has another approach to solve the problem, but each approachs don't work for all the workstations and browsers, then you should use several way concurrently.</p>

<table border='1' cellspacing='0' cellpadding='0'>
<tr><th>Option<th>Method to detect proxy automatically<th>Support<th>Doesn't support
<tr><th>1
    <td>Web Proxy Auto-Discovery (WPAD)
    <td>IE5.0 and above, Netscape
    <td>Old IE and other browser
<tr><th>2
    <td>DHCPINFORM
    <td>all windows platform?
    <td>?
<tr><th>3
    <td>Active Directory Group Policy
    <td>Within a domain<br>
        Windows 2000 Pro, Server<br>
        Windows XP Pro<br>
        Windows 2003 Server
    <td>Outside a domain<br>
        Windows 9x/Me<br>
        Windows XP Home Edition
</table>
<h2>Web Proxy Auto-Discovery (WPAD) (Option1)</h2>

The IE 5 (and higher) and Netscape Web Proxy Auto-Discovery (WPAD) feature enables web clients to automatically detect proxy settings without user intervention. The algorithm used by WPAD prepends the hostname "wpad" to the fully-qualified domain name and progressively removes subdomains until it either finds a WPAD server answering the hostname or reaches the third-level domain. For instance, web clients in the domain a.b.hoge.com would query wpad.a.b.hoge.com, wpad.b.hoge.com, then wpad.hoge.com. A vulnerability arises because in international usage, the third-level domain may not be trusted. A malicious user could set up a WPAD server and serve proxy configuration commands of his or her choice.

<ol>
<li><p>All clients should be enabled "Automatic detect settings", even though it's a default value.<br>
<img src="wpad01.gif"><br></p>

<li><p>Make a wpad.dat and proxy.pac file and copy it into root directory of local web server
<pre>
function FindProxyForURL(url,host)
{ if(isPlainHostName(host)||
    isInNet(host,"<b>192.168.0.0","255.255.255.0</b>")) return "DIRECT";
  else return "<b>PROXY 192.168.0.10:8080</b>; DIRECT";
}
</pre>
Note: wpad.dat is referred by WPAD, and proxy.pac is referred by DHCPINFORM (option2) and Active Directory Group Policy (option3)
</p>

<li><p>The web server should have <b>wpad</b> host name (or alias). You need to register to DNS. (A record or CNAME)</p>
<img src="wpad02.gif"><br>

</ol>

<h2>Detect proxy server using DHCPINFORM (Option2)</h2>
DHCP server can send DHCPINFORM message and then client can get javascript URL. DHCP server should be supported using DHCPINFORM. Windows 2000 Server/Windows .NET Server support it.
<ol>
<li><p>Open DHCP Window, right click the host name and select "Set Predefined Options..."<br>
<img src="wpad03.gif"></p>

<li><p>Click "Add" button at "Predefined Option and Values" window. And then type as below. You can give any name, but data type and Code should be "String" and "252"<br>
<img src="wpad04.gif"></p>

<li><p>Add "AUTO-PROXY-CONFIG" to each scope options and the value should point your proxy.pac file (make link to proxy.dat or copy same file to proxy.pac)<br>
<img src="wpad05.gif"></p>

</ol>

<h2>Active Directory Group Policy (Option3)</h2>
<p>You can configure proxy to client automatically using Active Directory Group Policy. But it works only computer which belongs to the domain. The supported OSs are only</p>
	<ol>
	<li>Windows 2000 Professional and Server
	<li>Windows XP Professional
	<li>Windows 2003 Server
	</ol>
<p>These are not supported</p>
	<ol>
	<li>Windows 9x/Me
	<li>Windows XP Home  Edition
	</ol>
<ol>

<li><p>Open "Active Directory Users and Computers", and then select OU (if you want to apply all your organization, select root domain) and open property. Click "Group Policy" tab, click [New] or [Edit] and open "Group Policy" window. Click "User Configuration"->"Windows Settings"->"Internet Explorer Maintenance"->"Connection"->"Automatic Browser Configuration" and open "Property".<br>
<img src="wpad06.gif"></p>

<li><p>Check [Automatic detect configuration settings] and [Enable Automatic Configuration], set the interval to [Automatic configure every] textbox and URL for proxy.pac file to [Auto-proxy URL] textbox.</p>
<img src="wpad07.gif"><br>

</ol>

<hr><a href="../index.html">Back</a> - <a href="../../index.html">Top</a> - <a href="../../../support.html">Support</a>

<!--#include virtual="/doc/footer.html" -->

</body>
</html>
