Tagged with proxy

Develop Against External Webhooks Locally Using Ngrok

I wanted to do some work developing some functionality against Github using Hubot, and I hit the classic challenge of attempting to develop against a webhook-centric interface: “How am I going to simulate the webhooks?”.

Fortunately I did some basic searching and stumbled across a project called Ngrok. Ngrok is a pay-what-you-want tool that allows you to expose a local server externally without all the headaches that would otherwise be necessary at the network infrastructure level.

Below follow step-by-step instructions on how to get up and going with Ngrok. Assuming your an on an OS X development machine. If you’re using another operating system most of the steps will be close but details will most likely vary.

Step 1. Sign Up With Ngrok (optional)

Incredibly it’s not actually necessary to sign-up for an Ngrok account to use their tool. If you don’t wish to signup you can simply proceed to Step 2., however, there are some nice features that are available if you do signup, such as custom subdomains and password protected tunnels. These instructions will assume you have signed up for an account, so if you skip this step your mileage may vary.

Simply proceed to https://ngrok.com/user/signup and enter your details, after signup you will be prompted to pay (only if you wish!) and then should eventually end up on a dashboard that looks something like this:

Step 2. Download Ngrok

Click on the downloading ngrok link on the dashboard (or here):

Download Ngrok

Choose the appropriate version of ngrok for your operating system:
Ngrok Download OS X

After downloading I chose to move ngrok to my Applications folder. This is not necessary, but if you place it in a different location adjust the rest of the instructions accordingly:
Move Ngrok to Applications

Step 3. Starting Ngrok

WARNING: This will expose your local port 80 to the internet. Exercise with Caution!

Simply run the command that is shown on your dashboard in a terminal to start Ngrok. It will look something like this:

ruby-2.1.2 ➜  ~  /Applications/ngrok -authtoken <YOUR AUTH TOKEN HERE> 80

The authtoken is only necessary the first time you start Ngrok as it remembers it in a ~/.ngrok file for you.

After starting ngrok, you should see something like this in your terminal:
Ngrok Terminal

Step 3. Testing Ngrok

Ngrok creates a web interface that’s available on port 4040, and can be used to inspect packets. You can checkout it out by going to http://localhost:4040 in your browser. You should see something like this:
Ngrok Web Dashboard

Ngrok has created both an http and https endpoint on the external web for your local Port 80. You can check out what happens by clicking on either link. For me, I currently have the default Apache “It works!” page running on my development machines port 80, so I see this:

56b49aac_ngrok_com

So at this point I now have a tunnel open that’s redirecting an external url to a local server. To start developing against those webhooks you simply need to give them that Ngrok URL as your webhook or call back endpoint, and start building!

But wait, there’s more!

Step 4. Checkout some other cool features!

Ngroks web interface will keep a history of all the requests it proxies, including request times, request/response header, body.

ngrok

It even has a “Replay” button, so you can retransmit any requests to your server. This means you can re-test any callbacks you want easily without having to drive the 3rd party system you are building against. This is a amazing feature, which will make development significantly faster by saving you the hassle of clicking-driving external products:

Resubmit Button

Conclusion

This is one of the coolest development tools I’ve seen this year, and on a pay-what-you-want model its an amazing value. If you try this out and get value from it, I highly recommend contributing back to the project. They accept paypal, so it’s easy to throw a few dollars their way. I personally think it’s well worth the recommended $25 yearly contribution.

Tagged , , , , , , , , , , ,

Accessing US-only blocked content in Canada (video)

This is a video of a dry-run of my screencast for DemoCamp 17 on accessing US-only content that is blocked from Canada.

Tagged , , , , , , , ,

Hulu seems to be working in Canada

Yesterday I was experimenting around with different proxy software, which I use to allow me to watch Hulu in Canada despite their attempts to block it based on IP address.  I was very surprised to discover by accident that even without my proxy running, I was still able to connect to, and watch content from Hulu from my Canadian address.  I have had a few friends try this, with similar results.  I encourage everyone to go and give it a shot, because Hulu has some great content, and it would be great if we could get this content in Canada without having to jump through the hoops.

Update (August 7th 2010):  Unfortunately this window seems to have been closed.  Hulu cut me off about 2/3 through a program, and doesn’t seem to be allowing us to watch shows anymore (without going through hoops anyways).

Tagged , ,

Watch Hulu Outside the US using Widecap

In my earlier posts on Pandora, I talk about setting up a proxy tunnel in order to be able to listen to Pandora even though you are outside the US.  Unfortunately, trying to use this same procedure to stream Hulu and watch your favorite TV shows doesn't work.  This is because the Flash plugin that is used to play videos by most site's doesn't use the proxy settings you have defined for your browser.  

One way around this is to use a "VPN" or "virtual private network" to similarly tunnel ALL the traffic from your computer through a server in the US, forcing even Flash to go through the tunnel.  I personally used this approach for a while, using a free tool called Anchor Free Hotspot Shield,  While this approach effectively worked, it always struck me as somewhat inelegant, and to the privacy concerned out there it can be concerning.  

That's why recently I was happy to stumble across a free program called Widecap.  Widecap allows you to configure applications to start in an encapsulated mode, allowing you to direct all traffic from the process into a tunnel as defined by you.  On my media PC I have it configured so that all my Firefox traffic travels through my proxy, and this forces even Flash to bounce through my server in the United States.  With this configuration I am able to take advantage of any of the US only services out there, including both Pandora and Hulu.  The unfortunate side of this solution is that it still requires you to have a proxy available in the US.

For more information on configuring a proxy, you can see my article on setting up Pandora.  If there is sufficient interest on this topic, I'll do a step-by-step how to on configuring Widecap.
Tagged , , ,