PAC file Exception

Posted on 2009-12-29
Last Modified: 2013-12-08
Hi Expert s
I am currently managing a network a network that consist of three sites(A,B,C) that are connected by an mpls link. i have deployed two proxy. One proxy in site A and the second proxy in site B.
I need to write a pac file that perform the following tasks
for users that are in site A subnet i want them to use proxy 1 ( port 80 ) and they should failover to proxy 2: port 80 in case proxy 1 is not active
for users that are in site B subnet i want them to use proxy 2: port 80 and they should failover to proxy 1 ( port 80 ) for users that are in site B subnet i want them to use proxy 2: port 80 and they should failover to proxy 1 ( port 80 )  in case proxy2 is not active in case proxy2 is not active
At the same time i want user to bypass the prxy in the following cases
If URL has no dots in host name and If IP address is internal or hostname resolves to internal IP send direct.

Question by:mzhaim
    1 Comment
    LVL 57

    Accepted Solution

    Obviously I can't test this so there are most likely (like 100% for sure) issues with the following, but this should get you started:

    function FindProxyForURL(url, host)
           if (isPlainHostName(host) ||
            (host == "") ||
            (isInNet(host, "",  "")) ||
            (isInNet(host, "",  "")) ||
                (isInNet(host, "",  "")) ||
                (isInNet(host, dnsResolve("") ,  ""))
                (isInNet(host, dnsResolve("") ,  ""))
                (isInNet(host, dnsResolve("") ,  "")))
          return "DIRECT" ;
                if (isInNet(myIpAddress(), "",  ""))
                      return "PROXY ; PROXY";
                if (isInNet(myIpAddress(), "",  "") ||
                      isInNet(myIpAddress(), "",  ""))
                            return "PROXY ; PROXY ";

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    New My Cloud Pro Series - organize everything!

    With space to keep virtually everything, the My Cloud Pro Series offers your team the network storage to edit, save and share production files from anywhere with an internet connection. Compatible with both Mac and PC, you're able to protect your content regardless of OS.

    This article offers some helpful and general tips for safe browsing and online shopping. It offers simple and manageable procedures that help to ensure the safety of one's personal information and the security of any devices.
    If your business is like most, chances are you still need to maintain a fax infrastructure for your staff. It’s hard to believe that a communication technology that was thriving in the mid-80s could still be an essential part of your team’s modern I…
    Here's a very brief overview of the methods PRTG Network Monitor ( offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
    This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor ( If you're looking for how to monitor bandwidth using netflow or packet s…

    761 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

    14 Experts available now in Live!

    Get 1:1 Help Now