+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast
Results 16 to 30 of 31
Internet Related/Filtering/Firewall Thread, Proxy .pac file in Technical; Hi this is my config file. When i set the location of the file in IE, It doesnt seem to ...
  1. #16

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,757
    Thank Post
    825
    Thanked 1,662 Times in 1,447 Posts
    Blog Entries
    11
    Rep Power
    441
    Hi this is my config file. When i set the location of the file in IE, It doesnt seem to point to the proxy server, the traffic isnt going through. Does anyone have any thoughts please?

    Thanks

    Code:
    function FindProxyForURL(url, host) {
    
        // Execptions for direct connection
        if (shExpMatch(url, "http://google.com/*")) { 
            return "DIRECT"; 
        }
        if (shExpMatch(url, "http://example2.com/*")) { 
            return "DIRECT"; 
        }
    
        // Proxy if PC is on local LAN
        if (isInNet(myIpAddress(), "172.16.96.1", "255.255.252.0")) {
            return "PROXY 172.16.96.52:8080";
        }
        if (isInNet(myIpAddress(), "172.16.16.1", "255.255.252.0")) {
            return "PROXY 172.16.16.30:8080";
        }
    
        // Everything else to go direct
        return "DIRECT";
    }
    Last edited by FN-GM; 20th September 2010 at 12:44 PM.

  2. #17
    steve's Avatar
    Join Date
    Oct 2005
    Location
    West Yorkshire
    Posts
    1,043
    Thank Post
    22
    Thanked 177 Times in 123 Posts
    Rep Power
    51
    How are you specifying the PAC file?

    DHCP option?

  3. #18


    Join Date
    Jan 2006
    Posts
    8,202
    Thank Post
    442
    Thanked 1,032 Times in 812 Posts
    Rep Power
    339
    I did experience some issues using myIpAddress when using a 22bit subnet mask - worked fine with 24 bit. No help to you at all.

  4. #19

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,757
    Thank Post
    825
    Thanked 1,662 Times in 1,447 Posts
    Blog Entries
    11
    Rep Power
    441
    Quote Originally Posted by steve View Post
    How are you specifying the PAC file?

    DHCP option?
    In IE.

    Thanks

  5. #20

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,757
    Thank Post
    825
    Thanked 1,662 Times in 1,447 Posts
    Blog Entries
    11
    Rep Power
    441
    Sorry can i just bump this. I was hoping to have this running today

    Thaks

  6. #21
    carvjo's Avatar
    Join Date
    Mar 2010
    Location
    Oxford
    Posts
    195
    Thank Post
    12
    Thanked 39 Times in 34 Posts
    Rep Power
    21
    Hi

    You mayhave done this but:

    Automatic Discovery for Firewall and Web Proxy Clients

    Regards

  7. #22

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,757
    Thank Post
    825
    Thanked 1,662 Times in 1,447 Posts
    Blog Entries
    11
    Rep Power
    441
    For those who want to know this is the code i now use and it works

    Code:
     
    function FindProxyForURL(url, host)
    
    {
    
    //Declare proxy strings as variables
    
    var kpproxy = "PROXY 172.16.16.52:8080";
    var qvproxy = "PROXY 172.16.96.52:8080";
    
    // URLS not to use proxy server
    
    if (shExpMatch(url, "*bbc.co.uk*")) { return "DIRECT"; }
    if (shExpMatch(url, "*itv.com*")) { return "DIRECT"; }
    
    // Slect Proxy Server
    
    if (isInNet(myIpAddress(), "172.16.16.0", "255.255.252.0")) { return kpproxy; }
    if (isInNet(myIpAddress(), "172.16.96.0", "255.255.252.0")) { return qvproxy; }
    
    else
    
    return "DIRECT";
    
    }

  8. Thanks to FN-GM from:

    Shielder (23rd September 2010)

  9. #23

    Join Date
    Mar 2010
    Posts
    39
    Thank Post
    24
    Thanked 9 Times in 6 Posts
    Rep Power
    10
    I'm also having a problem with Proxy PAC files I was hoping someone might be able to help me with?

    My PAC file is located in C:\proxy.pac and both Firefox and Opera work perfectly but IE8 fails, any ideas?


    PHP Code:
    function FindProxyForURL(urlhost)
    {
    //Declare proxy strings as variables
    if (isInNet(myIpAddress(), "10.242.0.0""255.255.0.0")) { return "PROXY 10.242.163.88:8080"; }
        else
    return 
    "DIRECT";


  10. #24


    tom_newton's Avatar
    Join Date
    Sep 2006
    Location
    Leeds
    Posts
    4,458
    Thank Post
    866
    Thanked 845 Times in 667 Posts
    Rep Power
    195
    In what way does it fail?

  11. #25

    Join Date
    Mar 2010
    Posts
    39
    Thank Post
    24
    Thanked 9 Times in 6 Posts
    Rep Power
    10
    Quote Originally Posted by tom_newton View Post
    In what way does it fail?
    "Internet Explorer cannot display the webpage" - If I manually enter the proxy server address and port it works.

    I've also ran PACtester and that reports the proxy correctly - it seems as if there's some change to the way IE8 uses PAC files?

  12. #26

    FN-GM's Avatar
    Join Date
    Jun 2007
    Location
    UK
    Posts
    15,757
    Thank Post
    825
    Thanked 1,662 Times in 1,447 Posts
    Blog Entries
    11
    Rep Power
    441
    I think you need the .pac file to run on a webserver. I installed IIS on our proxy and used that.

    Thanks

  13. #27
    steve's Avatar
    Join Date
    Oct 2005
    Location
    West Yorkshire
    Posts
    1,043
    Thank Post
    22
    Thanked 177 Times in 123 Posts
    Rep Power
    51
    Give this a go:

    Code:
    function FindProxyForURL(url, host) {
    
        // Execptions for direct connection
        if (shExpMatch(url, "*google.com*")
            shExpMatch(url, "*example2.com*"))
            return "DIRECT";
    
        // Proxy if PC is on local LAN
        if (isInNet(myIpAddress(), "172.16.96.0", "255.255.252.0"))
            return "PROXY 172.16.96.52:8080";
    
        else if (isInNet(myIpAddress(), "172.16.16.0", "255.255.252.0"))
            return "PROXY 172.16.16.30:8080";
    
        // Everything else to go direct
        else
            return "DIRECT";
    }

  14. #28

    Join Date
    Mar 2010
    Posts
    39
    Thank Post
    24
    Thanked 9 Times in 6 Posts
    Rep Power
    10
    FN-GM I have not tried it on a webserver as I want to put the PAC file locally onto some laptops - it's supposed to work as a local file.

    Steve - Thanks for your script but it didn't work even on Firefox or Opera (after changing the IP to suit) - but if I put my original code back into the PAC file it works in Firefox and Opera - it's just IE8 that I'm having a problem with.

    Note: I understand that IE caches some of this information so between tests I'm running CCleaner.

  15. #29
    Iain's Avatar
    Join Date
    Oct 2006
    Location
    Warwickshire
    Posts
    184
    Thank Post
    28
    Thanked 91 Times in 51 Posts
    Rep Power
    31
    How are you specifying the location of the .pac file in IE8? Your script works for me if I give the address of the file as

    Code:
    file://<path to script>

    See attached screenshot

    Quote Originally Posted by DarrenShan View Post
    FN-GM I have not tried it on a webserver as I want to put the PAC file locally onto some laptops - it's supposed to work as a local file.

    Steve - Thanks for your script but it didn't work even on Firefox or Opera (after changing the IP to suit) - but if I put my original code back into the PAC file it works in Firefox and Opera - it's just IE8 that I'm having a problem with.

    Note: I understand that IE caches some of this information so between tests I'm running CCleaner.
    Attached Images Attached Images

  16. #30
    box_l's Avatar
    Join Date
    May 2007
    Location
    Herefordshire
    Posts
    422
    Thank Post
    67
    Thanked 89 Times in 74 Posts
    Rep Power
    61
    Hi,
    I have wanted to use a .pac file for all the schools we support, the thing is, we have inherited a set of schools with 192.168. address sets.

    This is what everyone seems to have at home too so basing the pac on isInNet(myIpAddress() is a bit of a non-starter.

    Is there any way I can use some other part of the DCHP provided config?

    Like the DNS server address or default gateway maybe?

    TIA

    BoX
    Last edited by box_l; 23rd September 2010 at 11:19 PM. Reason: spelling

SHARE:
+ Post New Thread
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. OSX and Proxy.pac files
    By cookie_monster in forum Mac
    Replies: 0
    Last Post: 28th April 2010, 10:38 AM
  2. .pac files and horrible web proxy sites.
    By itwasntme in forum Internet Related/Filtering/Firewall
    Replies: 4
    Last Post: 10th March 2010, 12:13 PM
  3. Proxy .pac file
    By FN-GM in forum Internet Related/Filtering/Firewall
    Replies: 4
    Last Post: 10th February 2010, 10:33 AM
  4. proxy .pac file
    By sted in forum Windows
    Replies: 12
    Last Post: 24th September 2009, 07:50 PM
  5. Stupid proxy pac
    By Oops_my_bad in forum Wireless Networks
    Replies: 10
    Last Post: 23rd March 2009, 09:59 AM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •