Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Modify wpad.dat to allow users to go direct to non-standard ports and to allow variables for the proxy server name

Posted on 2009-02-11
3
Medium Priority
?
2,025 Views
Last Modified: 2013-12-14
I have a proxy.pac file that I have implemented as a wpad.dat for auto configuration of the proxy client in my network.  

I would like to accomplish two additional tasks:

1. Can I send websites direct if they have a custom port, such as https://wsh0101.uslec.net:8443/ or http://we109.apptura.net:2509

2. Can I substitute the proxy server with a variable to represent their local login server (I have 9 remote sites and want them to use the proxy at their location) i.e. var proxone=%logonserver%
//proxy.pac
function FindProxyForURL(url,host)
{
// set p1 and p2 to the 2 proxies
var p1="192.20.1.44"
var p2="192.20.1.41"
//find the 4th octet - if even, is p1/p2 else p2/p1
var myip=myIpAddress()
var ipbits=myip.split(".")
var myseg=parseInt(ipbits[3])
if(myseg==Math.floor(myseg/2)*2) {
var proxone=p1
var proxtwo=p2
}
else {
var proxone=p2
var proxtwo=p1
}
//if name has no dots, or is our domain, or starts 10., or if my
//current address does not start 10. don't use proxy
if(isPlainHostName(host) ||
dnsDomainIs(host,".mosaictileco.com") ||
myip.substring(0,9)!=="192.20.1." ||
host.substring(0,9)=="192.20.1." )
//
{
// alert("direct")
return "DIRECT";
}
else {
// alert("proxy")
return "PROXY "+proxone+":3128; PROXY "+proxtwo+":3128" ;
}
}

Open in new window

0
Comment
Question by:medlinis
  • 2
3 Comments
 
LVL 22

Accepted Solution

by:
cj_1969 earned 2000 total points
ID: 23692461
Check out this page ... http://en.wikipedia.org/wiki/Proxy_auto-config

This has some examples that show you how to check to see if a machine in within a particular subnet, which would allow you to do question 2 and it shows checking a URL to see if there is a port reference which would allow you to do question 1.

You might want to see if you can parse the data from URL to obtain the port and then see if it is equal or not to 80 or 8080 (outside the normal range of port references) otherwise this could be used as a bypass of the proxy servers.
0
 

Author Closing Comment

by:medlinis
ID: 31545755
This was exactly what I needed.  I have gotten all parts of the script working properly.

Thanks for the help
0
 

Author Comment

by:medlinis
ID: 23867987
One additional resource that I found extremely useful:

http://docs.huihoo.com/gnu_linux/squid/html/book1.html

0

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
When you put your credit card number into a website for an online transaction, surely you know to look for signs of a secure website such as the padlock icon in the web browser or the green address bar.  This is one way to protect yourself from oth…
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question