How to expose a local service to the internet

From time to time you might need to expose your locally running service to the external world - for example you might want to test a webhook that calls your service. To speed up the test/development feedback loop it would be great to be able to point that webhook to your local machine. Unfortunately local machines hardly ever have externally accessible ipv4 (sadly there is just not enough of those available).

There is a simple solution.
Install nodejs package localtunnel:

npm install -g localtunnel

and then run it, specifying what port do you want to be exposed:

lt --port 80

It will say something like this:

your url is: https://ancient-cat-90.loca.lt

localtunnel is very simple and will probably work great in most one-off simple cases. Huge advantage of it is that you don't need to create an account, mess with tokens, etc. If you need something more advanced I'd recommend looking at ngrok . Ngrok allows you to see a dashboard with a preview of all incoming traffic, set custom domains, and much more.

Let me know if you have any questions or thoughts in the comments below.


Let us help you on your journey to Quality Faster

We at Xolv.io specialize in helping our clients get more for less. We can get you to the holy grail of continuous deployment where every commit can go to production — and yes, even for large enterprises.

Feel free to schedule a call or send us a message below to see how we can help.

User icon
Envelope icon

or

Schedule a 30m call
  • Add types to your AWS lambda handler

  • For loops in JavaScript (vs _.times)

    From time to time I still see a for loop in JavaScript codebases. Linters are frequently angry about them. Let's see how we can replace them.

  • Sharing scalars between modules with Chimp

    Simplify your Chimp-based project even further with a new @predefined Scalar directive.