Set Web Proxy Address In Browser Automatically Like WPAD

a) WPAD could be set automatically (only in Internet Explorer) from DHCP – you have to add DHCP option, for example:

/ip dhcp-server option
add code=252 name=auto-proxy-config value=http://wpad.intranet/wpad.dat

(where value is address of your wpad script) and then use it in DHCP server network, for example:

/ip dhcp-server network
add address=192.168.100.0/24 dhcp-option=auto-proxy-config dns-server=192.168.100.1 gateway=192.168.100.1


b) More general way is to set configuration script URL in each browser (IE, Opera, Firefox), for example: http://wpad.intranet/wpad.dat – you don’t need to do anything on Mikrotik, but static DNS record may be useful (for example mentioned wpad.intranet).

Both ways need a webserver to place WPAD configuration script on.

 

000.JPG

001.JPG

1.Should I Create wpad.dat Manually(_Mikritik Did Not create it Automatically? Like Microsoft ISA Or TMG)

Yes, you have to prepare it manually.

2.If I Must Create Wpad.dat File Then What Is the WPAD Scrip?How Creat it? And Where I Must Place WPAD.DAT File????

Here you can find some information: http://en.wikipedia.org/wiki/Web_Proxy_ … y_Protocol
http://blog.freyguy.com/archives/2006/0 … d-firefox/

It should contain at least something like this:

function FindProxyForURL(url, host) { return "PROXY proxy.intranet:8080"; }';

– where proxy.intranet is name or IP address of your proxy (Mikrotik) and 8080 is it’s TCP port. But you may use something more sofisticated, of course.

I use this PHP script in index.php on my local web server:

<?php
if (isset($_REQUEST["wpad"]))
{
  header("Content-Type: application/x-ns-proxy-autoconfig; charset=utf-8");
?>
function FindProxyForURL(url, host)
{
  if (dnsDomainIs(host, ".local") || dnsDomainIs(host, ".intranet") || isPlainHostName(host) || shExpMatch(host, "192.168.1.*"))
    return "DIRECT";
  return "PROXY proxy.intranet:8080";
}
<?php
}
else
  header("location: http://www.mywebsite.x");

It is good if WPAD script is listening to various names, so I made this .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^wpad
  RewriteRule .* index.php?wpad=1 [L]
RewriteRule ^wpad\. index.php?wpad=1 [L]
RewriteRule ^wspad\. index.php?wpad=1 [L]
RewriteRule ^proxy\.pac index.php?wpad=1 [L]

– it is listening not only to file named wpad.dat, but also any wpad.* file and also on DNS name of server wpad.

3.If I Must Place WPAD.DAT File Manually Then How Can I Place it On Mikrotik Itself And set DHCP Option Value=http://<Mikrotik Ip>/wpad.txt ?

Unfortunately, Mikrotik is not a webserver, so you have to use your local webserver or maybe webserver on internet (but you have to add it to Walled Garden then) :(

4.On Several Forum I Read That DHCP Code for Wpad Is 249 Not 255 (_if This may Help:I Use Licecnce Level 6)?

I have found value of 252 as right value and it is working for me in Internet Explorer. I didn’t try value of 249, but you can try and let me know.

Rolar para cima