This is a pain for two reasons:
I also spend a lot of time tweaking my local environment to be just-how-I-like-it(tm).
Recently, I had an idea that, in hindsight, seems obvious. However, in talking with a few people, it seemed just novel enough to warrant the high bar of intellect that is a blog post. So here is the magic:
*.home.example.com
). I’m lucky that my home ISP allows me to have a static IP address, but a DynDNS or similar account would also work.Given the above, the rest is really quite simple (and perhaps obvious to some). A simple ssh port forward does the trick. Here’s the command I use:
ssh root@home.example.com -R 80:localhost:80
For the unfamiliar, that says ssh into home.example.com as root and send all the traffic coming to port 80 at home to port 80 on my localhost.
Voila! Now all requests to home.example.com will come to my local server and I can setup vhosts, etc accordingly. Also, if I just end my ssh connection, I no longer have to worry about the big, scary Internet accessing my dev sites.
I’m not 100% happy about allowing root ssh into my home network, so I may spend a rainy Sunday afternoon and setup an HTTP proxy at home that forwards to something like 8080 on localhost (and perhaps gives a nice “we’re not home” message if I’m not ssh’ed in). That way, I wouldn’t need to ssh in as root (which is necessary to bind the “low number” port).
If you do much tinkering with remote services (particularly OAuth-based services or webhooks, etc.), I hope this makes life just a little bit easier for you.
]]>