Hi! I'm currently reworking my site, so although this content is still online things may change or look odd. Please get in touch to find out how I can help you!

xip.io + MAMP Pro = Super-Easy Local Network Testing

I’m sure I don’t need to extol the virtues of working locally via MAMP Pro. One thing that has always annoyed me though is that to test on devices other than my main box, I’d have to either upload the files to a server or fiddle with something like DynDNS.

Recently though, I discovered xip.io. It’s a neat little service that takes 99% of the hassle out of viewing your local sites on any other device that’s connected to your network.

How to use it

  1. First things first, make sure your local server has a fixed IP on your local network. You can do this through the router config options. If you’re not sure how, just search for “[your router make/model] assign IP to computer” or something similar. This isn’t strictly necessary but it will save a lot of hassle down the line if you reboot your router and all the local IPs change.
  2. OK, so let’s say your server has the local IP address 192.168.0.1, and the local site you want to use with xip.io goes by the hostname example.local. In MAMP Pro, click on the example.local item under “Hosts”, then click the + button under the “Aliases” box.
  3. Enter the alias in the form [hostname].[server IP].xip.io. So in our example, we would enter example.local.192.168.0.1.xip.io. Leave the box ticked and don’t worry about the drop-down on the right.
  4. Hit “Apply” and restart the servers to update the config.
  5. On the network-connected device you want to test, navigate to the alias you just entered, and weep with joy at how easy it was.

That’s it! Bear in mind that anything that relies on the hostname in your code (cookies, for example) will be using the alias rather than the usual local hostname so be prepared to tweak some configs if needed.

Of course, you can still take advantage of the simpicity of xip.io if you dont use MAMP Pro, you’ll just need to set up the alias by hand. Personally though, I think the time saved with Pro is well worth paying a few quid for - it can often be found on those cheap software bundle sites for a hefty discount.

Tags: Development

Feedback

Sorry, feedback is now closed on this post, but please feel free to get in touch if you would like to talk about it!

Or find posts by tag →

Friends & Influences

  1. Aching Brain
  2. Andy Budd
  3. Anthony Killeen
  4. Ben Everard
  5. Cameron Moll
  6. Dan Cederholm
  7. Dan Mall
  8. Dave Shea
  9. Elliot Jay Stocks
  10. Jamie Knight
  11. Jamie Rumbelow
  12. Jason Santa Maria
  13. Jeff Croft
  14. Jeffrey Zeldman
  15. Jeremy Keith
  16. Jon Hicks
  17. Khoi Vinh
  18. Mark Boulton
  19. Matt Croucher
  20. Nocturnal Monkey
  21. Sarah Parmenter
  22. Shaun Inman
  23. Simon Collison
  24. Tim Van Damme
  25. Toby Howarth