I’ve been playing with Ruby on Rails recently and I’ve been using Pow as a rack server for the applications I’m working on. So I don’t have to keep running “rails server” when I want to test an app out. It’s a brilliant little tool from 37 Signals that they describe as a zero-config rack server and it is just that.
The only drawback to Pow is that it highjacks all localhost requests, this means that working with MAMP and Pow simultaneously can be tricky. The easiest and simplest solution would be to leave the MAMP port for apache to the default 8888 so you can access your htdocs folder from http://localhost:8888/
This works fine but it annoys me having to add the port number to all urls, so after a little bit of reading I discovered that Pow only hijacks IPv4 localhost not IPv6 so if we create our hostnames using IPv6 we should be able to get around this. Open up terminal and edit your hosts file, on the mac this is in /etc/hosts.
sudo mate /etc/hosts
Obviously change mate to your editor of choice. Then from here we need to change any hostnames using the old IPv4 loopback (127.0.0.1) to the new IPv6 loopback (::1). For example change
If you are using Safari or FireFox then this should now be working, if like me you are using Chrome then you will need to enable IPv6. You do this by adding chrome://net-internals/ to your address bar, then go to the DNS page and click the enable IPv6 button. Annoyingly this needs to be done every time chrome is restarted, if anyone knows how to enable this be default I would love to hear in the comments below.