Posts Tagged fbml
Facebook Application Development How-to: 11 Tips You Don’t Want to Miss
Posted by admin in entrepreneurs on February 28th, 2008
I’ve built several facebook applications now, and although none of them are as successful as my friend Ben’s “Make A Baby” application, I’m very happy with how they run. Here are the tricks that I used – although you’ll find them mentioned elsewhere, and each of them is important by itself, if you’re just getting started on your first facebook application, you need to know: Read the rest of this entry »
Using SSH Tunnels to develop Facebook Applications
Posted by admin in entrepreneurs on November 20th, 2007
One of the most frustrating things I found early on when working on facebook applications, was that there was no simple way to create a local development environment. Because so many of the features of the platform existed only when the code was executed THROUGH the facebook proxy (fbml parsing, fb:ref cache content, etc), I found myself in an almost endless cycle of “svn commit”, “svn up” on the test server. Although I could have reduced this to a single step using a capistrano deployment task, or (heavens forbid) simply edited the code in place on the server using VI, I wasn’t happy with either of these options.
By happy coincidence, I spent the day hacking away on FB apps with my friend Ben Savage, who showed me how *he* does it – he simply port forwards port 4100 on his local router into his laptop, and then sets the facebook application to use his current outside IP:4100 as the app url.
I didn’t like this for a few reasons – first, it requires admin access to the router, a no-go from Starbucks. Second, I don’t like having to change my facebook application settings every time I change offices. So I decided to try using an ssh tunnel.
After mucking about a bit, I got it working! Here’s what I had to do (and yes, it’s pretty ugly and you probably want to do this on a non-critical junk proxy box you’ve got somewhere):
Changes to /etc/ssh/sshd_config
1. You have to make the ssh connection as root in order to bind to a privileged port (it’s probably trivial to use a non-privileged port for this, but I couldn’t be bothered). So you need to enabled root logins, by adding/changing
PermitRootLogin yes
2. In order to bind to a network address other than localhost on the remote server, you need
GatewayPorts yes
Then you simply run this from console on your local machine:
ssh root@mytunnelbox.com -p22 -N -R *:8090/localhost/80
This will forward port 8090 on your remote server to port 80 on your local workstation, via ssh tunnel. I don’t usually bother to fork into the background, because it’s nice to be able to ctrl-c to finish up.
Now get into your facebook developer application (you probably want to create a test application for this), and change the Callback URL to mytunnelbox.com:8090/. (You’ll only have to do this the first time).
Voila! Local development facebook application work – from Starbucks or anywhere else!

