Axway Appcelerator Blog

The Leading Resource for All Things Mobile

Arrow Builder Debugging Tip – ngrok Secure Tunnel to localhost

2 Flares 2 Flares ×

During the development of Arrow Builder APIs, you are often running and debugging your Arrow Builder project locally on your machine prior to publishing. This development flow makes it convenient for debugging, as you have immediate and instantaneous access to console logging.

However, accessing your APIs from a local mobile device or a remote mobile device or computer is often difficult and insecure and involves opening ports on your firewall and forwarding incoming traffic to your machine’s IP addresses. Alternatively, you can publish your Arrow app to the cloud, but that is a time consuming process to do repeatedly.

In a previous post, I described how Cloud9 can be used to address this issue. Now, we’ll look at another approach.

I’ve been using a great service – called ngrok – which creates a secure tunnel to localhost without modifying your network. It’s very easy to set up and use, and the free tier is sufficient for most uses.

This blog post describes how to use ngrok with Arrow.

Install ngrok

  1. Go to the ngrok web site and create a free account

  2. Click the download button and follow the install instructions

Start ngrok

  1. Install your token from terminal using:

    
    ./ngrok authtoken <YOUR TOKEN FROM THE DASHBOARD PAGE>
    
  2. Start ngrok from the terminal using:

    
    ./ngrok http 8080
    

    Note: make sure you use the same port that your Arrow app is running on locally

  3. You will see something similar to below. Note the publicly accessible IP address (http://c5ff4678.ngrok.io and https://c5ff4678.ngrok.io) both of which will route to localhost:8080

    ngrok-1

    Note: if you stop ngrok and restart it, the IP address will change, so be careful

  4. You can now access your locally running Arrow API using the ngrok URL which is publicly accessible, for example:

    
    http://c5ff4678.ngrok.io/api/appc.mysql/table1
    
  5. You can track your ngrok requests in the browser on localhost, port 4040 as follows:

    
    http://localhost:4040
    
  6. You can now use the ngrok url in your mobile app and provide this url to anyone needing to test your API while you are still running the Arrow project locally.

2 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 2 Email -- 2 Flares ×

1 Comment

  1. ilay

    This is awesome, Leor.

    I have used Google’s online services, MySQL, previously. But it is costly…

Comments are closed.

Sign up for our blog!

Become a mobile leader. Take the first step to scale mobile innovation throughout your enterprise.
Get in touch
computer and tablet showing Appcelerator software
Start free, grow from there.
2 Flares Twitter 0 Facebook 0 Google+ 0 LinkedIn 2 Email -- 2 Flares ×