<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Cognition &#187; development</title>
	<atom:link href="http://www.cognition.ca/tag/development/feed" rel="self" type="application/rss+xml" />
	<link>http://www.cognition.ca</link>
	<description>Balls-in-the-air Entrepreneurship and Juggling.</description>
	<lastBuildDate>Tue, 14 Jun 2011 10:04:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Using SSH Tunnels to develop Facebook Applications</title>
		<link>http://www.cognition.ca/2007/11/using-ssh-tunnels-to-develop-facebook-applications.html</link>
		<comments>http://www.cognition.ca/2007/11/using-ssh-tunnels-to-develop-facebook-applications.html#comments</comments>
		<pubDate>Wed, 21 Nov 2007 01:55:00 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[entrepreneurs]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[facebook]]></category>
		<category><![CDATA[facebook applications]]></category>
		<category><![CDATA[fbml]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ssh tunnel]]></category>
		<category><![CDATA[tech]]></category>

		<guid isPermaLink="false">http://www.cognition.ca/?p=17</guid>
		<description><![CDATA[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 [...]]]></description>
			<content:encoded><![CDATA[<p>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 &#8220;svn commit&#8221;, &#8220;svn up&#8221; 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&#8217;t happy with either of these options.</p>
<p>By happy coincidence, I spent the day hacking away on FB apps with my friend Ben Savage, who showed me how *he* does it &#8211; 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.</p>
<p>I didn&#8217;t like this for a few reasons &#8211; first, it requires admin access to the router, a no-go from Starbucks. Second, I don&#8217;t like having to change my facebook application settings every time I change offices. So I decided to try using an ssh tunnel.</p>
<p>After mucking about a bit, I got it working! Here&#8217;s what I had to do (and yes, it&#8217;s pretty ugly and you probably want to do this on a non-critical junk proxy box you&#8217;ve got somewhere):</p>
<p><span style="font-style: italic">Changes to /etc/ssh/sshd_config</span></p>
<p>1. You have to make the ssh connection as root in order to bind to a privileged port (it&#8217;s probably trivial to use a non-privileged port for this, but I couldn&#8217;t be bothered). So you need to enabled root logins, by adding/changing<br />
PermitRootLogin yes<br />
2. In order to bind to a network address other than localhost on the remote server, you need<br />
GatewayPorts yes</p>
<p>Then you simply run this from console on your local machine:</p>
<p>ssh root@mytunnelbox.com -p22 -N -R *:8090/localhost/80</p>
<p>This will forward port 8090 on your remote server to port 80 on your local workstation, via ssh tunnel. I don&#8217;t usually bother to fork into the background, because it&#8217;s nice to be able to ctrl-c to finish up.</p>
<p>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&#8217;ll only have to do this the first time).</p>
<p><a href="http://bp1.blogger.com/_sHhNhXF24IE/R0OmAZKjrUI/AAAAAAAAAAc/iRFMFoZWyiU/s1600-h/Picture+5.png" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img src="http://bp1.blogger.com/_sHhNhXF24IE/R0OmAZKjrUI/AAAAAAAAAAc/iRFMFoZWyiU/s400/Picture+5.png" style="cursor: pointer" id="BLOGGER_PHOTO_ID_5135130525817875778" border="0" /></a></p>
<p>Voila! Local development facebook application work &#8211; from Starbucks or anywhere else!</p>
<span class="akst_link"><a href="http://www.cognition.ca/?p=17&amp;akst_action=share-this"  title="E-mail this, post to del.icio.us, etc." id="akst_link_17"  class="akst_share_link">Share This</a>
</span>]]></content:encoded>
			<wfw:commentRss>http://www.cognition.ca/2007/11/using-ssh-tunnels-to-develop-facebook-applications.html/feed</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

