There are always situations where you need to display the work on your local maichine to the outside world. In the old days, we would setup a dyndns account, forward some weird port on our firewall to port 80 on our local machine, and give out the weird URL. Those, my friends were the dark ages.
Now we have services like Pagekite. Basically, Pagekite makes it stupid easy to make a tunnel from your local machine to a URL on the outside world. It handles all the traffic tunneling for you, which is really impressive. It can basically forward any port, which makes it great for SSL and stuff.
On my local machine, I use Pow! for all of my rails development. It basically makes http://anything.dev point to a local running rails instance. It’s been discussed before, so I won’t go into it. But, Pow! works by reconfiguring your local DNS and making anything with .dev point to your localhost and a weird port behind the scenes. It needs to know what the hostname is in order to know what site to use.
Since Pagekite gives you one URL (at least by default) that doesn’t end in .dev, Pow! will have no clue what site to serve when you go to your Pagekite URL and just give you a generic welcome message. I came up with a quick hack to work around this limitation.
Create (or modify if you have one) a
~/.powconfig file. In it, put the following:
Now, restart Pow! (I use Powify, so that’s just
powify server restart for me). Then, create a new Pow! site for your current app that is the same name as your Pagekite hostname.
ln -s . ~/.pow/pagekitehostname
Voila! External page serving bliss. And if there’s a situation where you need to show a different app instead, you just change your pagekitehostname symlink to point to a different app instead. Easy!