Skip to main content

Expose your Local Development Environment to the outside world with Ngrok

When we develop on localhost, we usually use some kind of simple HTTP server like node, our Oracle database,APIs, webhooks, Callback Urls or whatever.
This is all good and we are all pretty happy about that. We have access to our app using our fancy http://localhost url. We are happy, but alone.
What if you would like to share your app to a colleague that is not on the same network as yours ? What if you need to check your app on an SSL connection? What if you wanted an external system to pass you a process invoked by a method ?
ngrok to the rescue
Ngrok is a simple “free” service that can help you with that. Here’s some of the features that it provides:
  1. Expose your locally hosted app/website to the outside world by providing you a http(s)://{something}.ngrok.io url.
  2. Allows you to have an SSL connection to your localhost environment.
  3. Inspect/replay the requests made to your local environment
  4. Custom subdomain (required a premium account)
  5. Password protect your exposed service
  6. And more...
Installing
To install, you have different options to choose from
  1. The official way: Downloading a zip file and unzip it
  2. Using NPM/Yarn : npm install ngrok -g. Package information here
It’s a good idea here to create a free account in order to increase the connections rate limit from 20 to 40. The process is quick and really easy.
Exposing our localhost:8080(can be any port) port

You can see that ngrok gives us now access to 3 urls:
  1. http://4fc79cf7.ngrok.io : Our webapp on standard http protocol
  2. https://4fc79cf7.ngrok.io : Our webapp on secure https protocol
  3. http://127.0.0.1:4040 : A nice web interface to inspect our tunnel
Password protect our tunnel
Here’s how you can add a username/password authentication to your tunnel

This will protect your tunnel with the login hello and password world
Exposing SSH server on port 22
Here’s how you can expose your local machine SSH port to the world. Pretty dangerous but do that if you know what you’re doing.

What about using Virtual Hosts?
You just need to include the host-header flag 
For example, if I wanna expose the virtual host/docker: demo.local.vh:80 

More information?
You can access to the docs or read FAQs
Free user plan:
  1. HTTP/TCP tunnels on random URLs/ports
  2. 1 online ngrok process 
  3. 4 tunnels per ngrok process
  4. 40 connections / minute (error 429) 
Conclusion 
Ngrok is a powerful tool to expose your local services through secure tunnels.You can use it to expose web servers,API Rest,SSH, databases  and many others for free.
Happy Apexing.!

Comments

Post a Comment

Popular posts from this blog

Disabling of Password Expiration in Oracle Apex(Internal Workspace Admin)

This post was inspired by a  question  on the OTN APEX forum, which contains how to  reset set the password of the  Oracle Internal Workspace Admin    and  Set the account never to expire  The first bullet has so many blogs  talk about how to reset the password of the Internal Workspace. However, i am more intrigued with the second . To start of with It is not advisable to never expire accounts since its rudimental for user to always renew their accounts  prior to expiration. The default expiration of an account is mostly 180 days so hey whats the point going to do this again after 180 days?? . There are two methods that can be used to achieve this  Generic Never expiration of all User accounts (This should never be practiced in a production Environment All database users are assigned to something called a PROFILE . The profile controls two aspects of the users database acce...

How does one add a day/hour/minute/second to a date value?

DATE is the datatype that we are all familiar  with when we think about representing date and time values. It has the ability to store the month, day, year, century, hours, minutes, and seconds. It is typically good for representing data for when something has happened or should happen in the future.  The problem with the DATE datatype is its' granularity  when trying to determine a time interval between two events when the events happen within a second of each other. This issue is solved with the TIMESTAMP datatype. In order to represent the date stored in a more readable format, the TO_CHAR function has traditionally been wrapped around the date: SQL> SELECT  TO_CHAR(hiredate,'DD.MM.YYYY:HH24:MI:SS')  "hiredate"   FROM employees; hiredate ------------------- 17.12.1980:00:00:00 20.02.1981:00:00:00 The SYSDATE pseudo-column shows the current system date and time. Adding 1 to SYSDATE will advance the date by 1 day. Use fractions to add hours...