--- Sjoerd Hooft's InFormation Technology ---

User Tools

Site Tools



Would you like to sponsor this site?
Or buy me a beer?:

Recently Changed Pages:

View All Pages
View All Q Pages

View All Tags

Sign up for Q to post comments.

WIKI Disclaimer: As with most other things on the Internet, the content on this wiki is not supported. It was contributed by me and is published “as is”. It has worked for me, and might work for you.
Also note that any view or statement expressed anywhere on this site are strictly mine and not the opinions or views of my employer.

Terms And Conditions for Q users

Pages with comments

2019/06/22 10:36 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 1 Comment
2019/03/15 16:02 3 Comments
2017/04/20 15:28 1 Comment
2017/04/20 15:23 1 Comment
2017/04/19 14:44 1 Comment
2017/04/17 20:10 1 Comment
2017/04/17 20:07 1 Comment
2017/04/17 19:58 1 Comment
2017/04/17 19:52 1 Comment

View All Comments


Proxy Pac

If you've created a proxy server you can create an automatic proxy script so your users don't have to turn off the proxy for internal addresses and it's easier to make changes.

An example proxy pac file

 * Standard proxy.pac automatic proxy configuration.
 * sjoerd [@]
 * 22 aug 2008
 * Will not proxy for short hostnames for domain.local and raw URL http://10.*

function FindProxyForURL(url, host)
 // If no domain name in the host(no dots) are found go DIRECT
  if (isPlainHostName(host) || dnsDomainIs(host, ".domain.local"))
     return "DIRECT";
  else if (url.substring(0, 10) == "http://10." ||
           url.substring(0, 11) == "https://10." ||
           url.substring(0, 11) == "http://127." ||
           url.substring(0, 12) == "https://127." )
     return "DIRECT";
     return "PROXY proxy:8080";

Note that you need a DNS record for the proxy

2nd example

function FindProxyForURL(url, host) 
  // our local URLs from the domains below don't need a proxy:
  if (shExpMatch(url, "**")) {
  return "DIRECT";
  } else {
  // All other requests go through port 3128 of
  return "PROXY";


To use a proxy.pac file place it in the document root of your webserver:

cat /etc/apache2/default-server.conf | grep -i root
DocumentRoot "/srv/www/htdocs"

Now you can enter an “automatic proxy configuration url” (firefox) or “Use automatic configuration script” (Internet explorer). The address would be:

More information

All the possible options are described here:

You could leave a comment if you were logged in.
proxypac.txt · Last modified: 2013/03/26 21:04 by sjoerd