Solved

how to edit proxy.pac file

Posted on 2008-06-22
3
3,869 Views
Last Modified: 2012-05-05
Hi... I have a proxy.pac file that gets applied through group policy so that if users from our office use the internet it goes through our proxy server, but if they are outside our network than the connection is direct. I want to modify this file so that it applies for all our other offices throughout the country. The file currently is as follows:

function FindProxyForURL(url,host)
{
if(isInNet(myIpAddress(),"10.21.1.0","255.255.255.0"))
return "PROXY 10.21.1.32:8080";
else
return "DIRECT";
}

I tried to modify it myself, but it doesn't work, as I don't really know the write syntax or what language it even is. But from my attempt, you should be able to see what I'm trying to achieve:

function FindProxyForURL(url,host)
{
if(isInNet(myIpAddress(),"10.21.1.0","255.255.255.0"))
return "PROXY 10.21.1.32:8080";
or
if(isInNet(myIpAddress(),"10.21.2.0","255.255.255.0"))
return "PROXY 10.21.1.32:8080";
or
if(isInNet(myIpAddress(),"10.21.3.0","255.255.255.0"))
return "PROXY 10.21.1.32:8080";
or
if(isInNet(myIpAddress(),"10.21.4.0","255.255.255.0"))
return "PROXY 10.21.1.32:8080";
or
if(isInNet(myIpAddress(),"10.21.5.0","255.255.255.0"))
return "PROXY 10.21.1.32:8080";
or
if(isInNet(myIpAddress(),"10.21.6.0","255.255.255.0"))
return "PROXY 10.21.1.32:8080";
or
if(isInNet(myIpAddress(),"10.21.9.0","255.255.255.0"))
return "PROXY 10.21.1.32:8080";
else
return "DIRECT";
}

any assistance would be appreciated.
0
Comment
Question by:tezza80
  • 2
3 Comments
 
LVL 24

Accepted Solution

by:
purplepomegranite earned 125 total points
ID: 21846707
It's a form of JavaScript, I believe.  The attached is the correct syntax though.
function FindProxyForURL(url,host)

{

if(isInNet(myIpAddress(),"10.21.1.0","255.255.255.0")) return "PROXY 10.21.1.32:8080";

if(isInNet(myIpAddress(),"10.21.2.0","255.255.255.0")) return "PROXY 10.21.1.32:8080";

if(isInNet(myIpAddress(),"10.21.3.0","255.255.255.0")) return "PROXY 10.21.1.32:8080";

if(isInNet(myIpAddress(),"10.21.4.0","255.255.255.0")) return "PROXY 10.21.1.32:8080";

if(isInNet(myIpAddress(),"10.21.5.0","255.255.255.0")) return "PROXY 10.21.1.32:8080";

if(isInNet(myIpAddress(),"10.21.6.0","255.255.255.0")) return "PROXY 10.21.1.32:8080";

if(isInNet(myIpAddress(),"10.21.9.0","255.255.255.0")) return "PROXY 10.21.1.32:8080";

return "DIRECT";

}

Open in new window

0
 
LVL 24

Expert Comment

by:purplepomegranite
ID: 21846726
Not a form of JavaScript, it is a JavaScript function!
0
 

Author Comment

by:tezza80
ID: 21852608
Thanks for your help. I tested it out on a remote laptop and it worked.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
A short article about problems I had with the new location API and permissions in Marshmallow
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …

919 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now