Connecting to MAMP sites from other local network clients

Nerd alert: this is a technical issue and not for everyone, but it’s something I come across every day, so I thought I would share it. I start most of my web development on my local Mac, using MAMP Pro to quickly get a new site up and running. Once I’ve gotten far enough along to share the work with a client, I’ll move the site to a live server, but for the first 75% of the development process I usually find local development to be faster.

The one hitch I’ve found with using MAMP Pro for local development is that I can’t easily preview the site from another machine. This might be a quick glance at an iPhone or iPad to see how a certain feature looks on those devices, or I could be sharing the site with a colleague to get an opinion. I could set up dynamic DNS, but that feels like overkill for sharing with other local clients, and it doesn’t work everywhere.

The solution is to create a local proxy server on the machine that has MAMP installed, and then configure the client to use that proxy to browse the web. The client configuration only takes a few seconds, and is easy to disable once you’re done.

Software required: Mac OS, MAMP or MAMP Pro, and SquidMan.

Step 1: Set up your new site in MAMP as you normally would. Be sure to select an IP address for your site. Once you’ve restarted the MAMP server, the local site should resolve in your browser. I usually set up my local sites as “sitename.local”. In this case the sitename is gumby.local, because I’m testing out the Gumby Framework.

Step 2: Install SquidMan. This is pretty straightforward, you don’t need to change any of the defaults, but you do need to add your IP subnet to the “Clients” tab. Start the Squid server.

Step 3: Configure the proxy settings on the machine you want to connect from. In this example I’ve added a proxy configuration to my iPad. The “Server” setting is the IP address of the MAMP server, the port is whatever you set up in SquidMan, the default is 8080.

If all has gone well, you should be able to use your browser to navigate to the MAMP server. Here’s a screenshot of my iPad connected to http://gumby.local.

Happy coding!

Comments are closed.