Questions tagged [pac]

A proxy auto config file (PAC) is used by a web browser (or other agent) to choose the proxy server to be used using the specified URL as a criteria for the selection.

A proxy auto-config (PAC) file defines how web browsers and other user agents can automatically choose the appropriate proxy server (access method) for fetching a given URL.

A PAC file contains a JavaScript function FindProxyForURL(url, host). This function returns a string with one or more access method specifications that cause the user agent to use a particular proxy server, or to connect directly.

This is an example of a very simple PAC file:

function FindProxyForURL(url, host) {
    return "PROXY proxy.example.com:8080; DIRECT";
}

this PAC file instructs the browser to retrieve all pages through the proxy on port 8080 of the server proxy.example.com. Should this proxy fail to respond, the browser tries to contacts the Web-site directly, without using a proxy.

A more complicated PAC file can be like this:

function FindProxyForURL(url, host) {
    // our local URLs from the domains below example.com don't need a proxy:
    if (shExpMatch(host, "*.example.com")) {
        return "DIRECT";
    }

    // URLs within this network are accessed through
    // port 8080 on fastproxy.example.com:
    if (isInNet(host, "10.0.0.0", "255.255.248.0")) {
        return "PROXY fastproxy.example.com:8080";
    }

    // All other requests go through port 8080 of proxy.example.com.
    // should that fail to respond, go directly to the WWW:
    return "PROXY proxy.example.com:8080; DIRECT";
}
150 questions
1
vote
0 answers

Inno Setup, WinHttpReq request through proxy server with PAC url

I am currently trying to write a service in Pascal that allows my installation in Inno Setup to communicate through a proxy server. I was able to do it with a host and port number, but now I need it also to implement recorring to a PAC file. I just…
Joao
  • 15
  • 4
1
vote
1 answer

Ubuntu apt-get with .pac files

I would like to use Ubuntu's apt-get on my computer, which is behind a company proxy server. Our browsers use a .pac file to figure out the right proxy. In the past, I browsed through that file and manually picked a proxy, which I used to configure…
zeus300
  • 1,017
  • 2
  • 12
  • 30
1
vote
1 answer

PAC file best practice

I'm trying to clean up a PAC file. Which of the following code blocks are more concise and/or faster? if (host == "localhost") {return "DIRECT";} if (shExpMatch(host, "localhost.*")) {return…
Joe Fruchey
  • 379
  • 3
  • 10
1
vote
1 answer

Using a PAC file in a Chrome Extension to redirect HTTPS requests seems to fail

I'm setting up a Chrome Extension (version 40) for myself and my work colleagues. One of it's functions is to automatically redirect requests that are received within the browser to our staging server IP address. This allows us to avoid editing…
1
vote
0 answers

Proxy Issues: automatic configuration script (http://127.0.0.1:8080/proxy.pac )

I have been using "Hola Better Internet" (proxy plugin) on chrome for long time. Recently I had lot of problems with it. Google search is not working properly and it also not let me to sign in to gmail. yahoo and bing works well. When I check proxy…
Vijayabalaji
  • 31
  • 1
  • 6
1
vote
1 answer

Fiddler(core) - modify built-in pac script

I noticed today that Fiddler has the ability to deliver a PAC file rather than setting its self up as a system-wide proxy. For example if you set your autoconfig URL in Internet Explorer to http://localhost:8888/proxy.pac fiddler delivers the…
1
vote
2 answers

Check if string contains a regex & no js

I have a string and I need to make sure that it contains only a regular expression and no javascript because I'm creating a new script with the string so a javascript snippet would be a security risk. Exact scenario: JS in mozilla addon loads…
Malte Goetz
  • 792
  • 6
  • 16
1
vote
1 answer

Fiddlercore proxy only certain websites?

I am trying to debug an issue with a website that is extremely intermittent. To do this I have set up fiddlercore as a service on my machine so that it automatically runs at start-up and captures all traffic until the issue presents itself…
James
  • 656
  • 2
  • 10
  • 24
1
vote
0 answers

Unable to install proxy pac file on browser

I wrote a proxy pac file and hosted it on my apache tomcat server. Upon much research, i came up with this code to direct a proxy to the following ip address. However , it does not redirect to my proxy at all function FindProxyForURL(url, host) {…
Clearner88
  • 101
  • 1
  • 11
1
vote
1 answer

Can I retrieve user's PAC file (Proxy Auto Config)?

Is it possible? Currently I'm trying per domain to get what proxy the system designates to it, this way: Uri website = new Uri("http://google.com"); System.Net.IWebProxy defaultproxy = System.Net.WebRequest.GetSystemWebProxy(); Uri proxy =…
pca1987
  • 323
  • 3
  • 15
1
vote
0 answers

Proxy PAC Script didn't work for several URL

Ladies and Gentlemen. Recently, my ISP block several URL. I tried Freegate and it's work fined without problem. http://en.wikipedia.org/wiki/Freegate but, it's too lazied to switch proxy manually hand by hand, so I decided to use PAC Script to…
1
vote
1 answer

InternetSetOption deletes my registry value - AutoConfigURL

I am settings proxy pac file using c#, I understand that I need to set values in HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections\DefaultConnectionSettings and in HKCU\Software\Microsoft\Windows\CurrentVersion\Internet…
Ron Gross
  • 1,474
  • 5
  • 19
  • 34
1
vote
0 answers

How to load Proxy Auto Config (PAC) file in Android with java

I want to create a proxy application only connectting specific web sites with proxy. I am thinking using pac file in this application, but i didn't find any source for this. How can i load pac file programmatically in android? If there isnt any way…
Oktay Ayar
  • 267
  • 5
  • 16
1
vote
0 answers

unable to overcome the error PAC::ProgramError from my Rails application

I am new to Ruby. I have written a simple code : ... pac = PAC.load(pacfilename) return pac.find('http://www.google.com') ... I am using gems gem 'win32-service', '0.8.2', :platforms => :mingw gem 'pac', "~> 1.0.0" gem 'therubyracer',…
1
vote
1 answer

What is the best way to use .PAC in C# when request is redirected

Background I have to use the proxy server specified by users in my application. Right now, I check that the input proxy contains ".pac" or not. If yes, I'll get the real proxy from pac file.…
Moozz
  • 609
  • 6
  • 18