MyPal
Occasional Visitor
OK, so I have created /jffs/scripts/dnsmasq.postconf. It loads and is persistent across reboots as expected.
Hosts resolve, no problem.
The /www folder links wpad.dat to proxy.pac. These reside in the /www/ext/ folder which is fine.
The nature of this folder is that contents do not persist across reboots. I would like to re-point /ext to /jffs/ext, so that my proxy.pac does not get deleted.
It would be great if the Merlin GUI did allow you to save your wpad.dat (proxy.pac) so it can be referenced on the router's local web server. My preference is not to use another wpad host.
How do I do this?
Here is my DNSMasq AutoProxy config (DHCP & DNS hosts.)
I use a "?" at the end of the URL which seems to fix Windows & IOS.
!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
IP=192.168.XXX.1
DOMAIN=my.home.local
pc_append "address=/wpad/$IP" $CONFIG
pc_append "address=/wpad.$DOMAIN/$IP" $CONFIG
pc_append "address=/proxy/$IP" $CONFIG
pc_append "address=/any-other-host/xxx.xxx.xxx" $CONFIG
pc_replace 'dhcp-option=lan,252,"\n"' 'dhcp-option=lan,252,"http://wpad.'$DOMAIN'/wpad.dat?"' $CONFIG
Here is my proxy wpad.dat (proxy.pac) redirection script:
function FindProxyForURL(url, host) {
// If the hostname matches intranet, send direct.
if (isPlainHostName(host) || shExpMatch(host, "*.local")) return "DIRECT";
// If the hostname matches, send direct.
if (shExpMatch(host, "(wpad.mydomain.net|nas.mydomain.net|router.mydomain.net|synology.myaccountname.me|myaccountname.dynu.net|*.ipleak.net|ipleak.net)"))
return "DIRECT";
// If the protocol or URL matches, send direct.
if (url.substring(0, 4)=="ftp:" ||
shExpMatch(url, "*.a-domain-name.net*"))
return "DIRECT";
// If the IP address of the local machine matches, send direct.
var my_Ip = myIpAddress();
if (shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX"))
return "DIRECT";
// If the requested Hosts are DNS Resolved, send direct.
var resolved_ip = dnsResolve(host);
if (shExpMatch(resolved_ip, "XXX.XXX.XXX") ||
shExpMatch(resolved_ip, "XXX.XXX.XXX") ||
shExpMatch(resolved_ip, "XXX.XXX.XXX"))
return "DIRECT";
// If the requested website is hosted within the internal network, send direct.
if (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0") ||
isInNet(resolved_ip, "172.16.0.0", "255.240.0.0") ||
isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") ||
isInNet(resolved_ip, "127.0.0.0", "255.255.255.0"))
return "DIRECT";
// If the IP address of the local machine is within a defined
// subnet, send to a specific proxy.
if (isInNet(my_Ip, "192.168.XXX.0", "255.255.255.0"))
// un-remark to console check that this is working
// alert("My IP Address: " + my_Ip + " Host: " + host + " URL: " + url);
return "PROXY myproxy:XXXX";
// DEFAULT RULE: All other traffic, use below proxies, in fail-over order.
return "PROXY myproxy:XXXX; PROXY myproxy.local:XXXX; DIRECT";
Hosts resolve, no problem.
The /www folder links wpad.dat to proxy.pac. These reside in the /www/ext/ folder which is fine.
The nature of this folder is that contents do not persist across reboots. I would like to re-point /ext to /jffs/ext, so that my proxy.pac does not get deleted.
It would be great if the Merlin GUI did allow you to save your wpad.dat (proxy.pac) so it can be referenced on the router's local web server. My preference is not to use another wpad host.
How do I do this?
Here is my DNSMasq AutoProxy config (DHCP & DNS hosts.)
I use a "?" at the end of the URL which seems to fix Windows & IOS.
!/bin/sh
CONFIG=$1
source /usr/sbin/helper.sh
IP=192.168.XXX.1
DOMAIN=my.home.local
pc_append "address=/wpad/$IP" $CONFIG
pc_append "address=/wpad.$DOMAIN/$IP" $CONFIG
pc_append "address=/proxy/$IP" $CONFIG
pc_append "address=/any-other-host/xxx.xxx.xxx" $CONFIG
pc_replace 'dhcp-option=lan,252,"\n"' 'dhcp-option=lan,252,"http://wpad.'$DOMAIN'/wpad.dat?"' $CONFIG
Here is my proxy wpad.dat (proxy.pac) redirection script:
function FindProxyForURL(url, host) {
// If the hostname matches intranet, send direct.
if (isPlainHostName(host) || shExpMatch(host, "*.local")) return "DIRECT";
// If the hostname matches, send direct.
if (shExpMatch(host, "(wpad.mydomain.net|nas.mydomain.net|router.mydomain.net|synology.myaccountname.me|myaccountname.dynu.net|*.ipleak.net|ipleak.net)"))
return "DIRECT";
// If the protocol or URL matches, send direct.
if (url.substring(0, 4)=="ftp:" ||
shExpMatch(url, "*.a-domain-name.net*"))
return "DIRECT";
// If the IP address of the local machine matches, send direct.
var my_Ip = myIpAddress();
if (shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX") ||
shExpMatch(my_Ip, "192.168.XXX.XXX"))
return "DIRECT";
// If the requested Hosts are DNS Resolved, send direct.
var resolved_ip = dnsResolve(host);
if (shExpMatch(resolved_ip, "XXX.XXX.XXX") ||
shExpMatch(resolved_ip, "XXX.XXX.XXX") ||
shExpMatch(resolved_ip, "XXX.XXX.XXX"))
return "DIRECT";
// If the requested website is hosted within the internal network, send direct.
if (isInNet(resolved_ip, "10.0.0.0", "255.0.0.0") ||
isInNet(resolved_ip, "172.16.0.0", "255.240.0.0") ||
isInNet(resolved_ip, "192.168.0.0", "255.255.0.0") ||
isInNet(resolved_ip, "127.0.0.0", "255.255.255.0"))
return "DIRECT";
// If the IP address of the local machine is within a defined
// subnet, send to a specific proxy.
if (isInNet(my_Ip, "192.168.XXX.0", "255.255.255.0"))
// un-remark to console check that this is working
// alert("My IP Address: " + my_Ip + " Host: " + host + " URL: " + url);
return "PROXY myproxy:XXXX";
// DEFAULT RULE: All other traffic, use below proxies, in fail-over order.
return "PROXY myproxy:XXXX; PROXY myproxy.local:XXXX; DIRECT";
Last edited: