Bypassing a Proxy Server for a Single Host on OS X When Using PAC file

Recently I wanted to mess around with a little PHP and I needed a quick and easy route to getting a LAMP stack running. Rather than set it all up from scratch, I decided to give Turnkey Linux a try. I downloaded a small OVA file and had it up and running in VMWare Fusion in no time with one catch; I couldn't connect to the webserver from my Mac. SSH was working so I knew the VM was reachable. I disabled the setting for my proxy server and immediately it was working. I had hoped I could just add my virtual host to the "Bypass proxy settings for these Hosts & Domains" box but it turns out that only works for simple proxy configs. The problem is that OS X will ignore this setting if you use a PAC (proxy auto config) file, which we do at my workplace.

Eventually I came with with a little hack to get around it. The PAC file is configured to bypass the proxy for our entire FQDN for our Active Directory domain, so I just created an entry for my virtual machine in /etc/hosts called lamp.my.company.domain.com and I was good to go!

MACXXXXXXXXXX:bin kevin$ cat /etc/hosts
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1    localhost
255.255.255.255    broadcasthost
::1             localhost 
172.16.21.129   lamp.my.company.domain.com
MACXXXXXXXXXX:bin kevin$