How To Do Local Web Development on an Unsecured Wireless Network
Or: how to avoid hours of banging your head against the wall.
This past weekend, I attended DrupalCamp LA 2012. It was great. I gave just one talk this year, running down modules and what they do like the Micro Machines Man, but it seemed to go well. More on the camp in a future post.
While I was there, I was working on a new project, and went through my usual routine of setting up the site locally via MAMP. What was unusual is that I was working on unsecure public wifi instead of my home network. To keep things more secure, I use Sidestep, a really nice utility for Mac OS X that can automatically set up an SSH tunnel and SOCKS proxy to protect all network traffic. Basically, it allows you to connect to the internet over dirty public wireless network in a way that's much more difficult to sniff. This will protect you from things like Firesheep. It's really great, but it caused me some pretty substantial issues with my MAMP setup.
By default, MAMP uses port 8888 for local websites, so when I set up a local site, I give it a domain and virtual host, with a URL that ends up looking like this:
http://local.clientname.com:8888/
The problem is this: when Sidestep is engaged and my requests are going through the SOCKS proxy, these links don't work anymore. I don't really understand networking deeply enough to know exactly what's going wrong, but I know that when the proxy is not engaged, everything works normally. I was having problems where requests would go forever and finally time out, or the host wouldn't be found, and various other things. It was pretty frustrating.
The solution, for me, was to open my Mac's Network Preferences, click Advanced… and then the Proxies tab. I added "local.*" to the "Bypass Proxy Settings For These Hosts & Domains" section, like this:
And that seemed to solve the problem. All my normal internet traffic was running through the proxy, while the MAMP stuff I was working on stayed local. The best of both worlds! Right now I'm wondering what "Bypass simple hostnames" means, but I haven't seen anything yet in cursory searches. If you know, please let me know.
Comments
Thanks!
Thanks! Took me a little while to figure out that after clicking "OK" on the Advanced dialog I had to also click "Apply" for it to actually take effect.
True, that is an additional, necessary step. Thanks for posting, Jeff.