Pow, IPv6 and localhost

Pow is a new zero-configuration server for Rack web applications by 37Signals. It makes development, especially on multiple applications, painless: it adds a new .dev domain, with individual apps symlinked from ~/.pow. Pow manages application instances automatically and integrates seamlessly with RVM.

I’ve been using Passenger Standalone instead of WEBrick or Mongrel for a while and it’s great, but Pow simplifies things even further: now I don’t even have to restart the server when switching between projects.

The only thing that bothered me is that it installs a firewall rule to forward traffic from port 80 to 20559. I do some PHP work under the Apache that ships with OS X and I don’t want to add a port number to my URL there, nor do I want to uglify those nice new .dev URLs for Pow.

Oddly enough, though, this isn’t true for me. If I go to localhost, up came the expected page from Apache, while foo.dev went to Pow. I didn’t specify a port for either.

What’s happening is that localhost is resolving to an IPv6 address (::1) and the ipfw rule doesn’t cover IPv6, only IPv4.

In this case, “it’s not a bug, it’s a feature” is 100% true. I hope Pow never “fixes” this.

Update June 29: Sadly, while I haven’t updated Pow, Mac OS X 10.6.8 now resolves “localhost” to the IPv4 address and this little trick has stopped working for me. Using the IPv6 loopback address is still OK: http://[::1]/.