Better Programming

Advice for programmers.

Follow publication

Member-only story

How To Expose Your Local Host URL as a Public URL

Rahul Banerjee
Better Programming
Published in
3 min readOct 28, 2021

--

A tunnel
Photo by Aaron Burden on Unsplash

Basically, instead of http://127.0.0.1:5000/, you’d want something like http://35cc-69-58-102-156.ngrok.io so that others could access it as well. This article will talk about two ways you can do so.

What Does It Mean To Expose Your Localhost URL?

  • First of all, it is temporary. Unless you opt for a paid option, most public URLs will expire in a few hours. You can always generate a new one.
  • The exposed URL will basically be in sync with your localhost URL. Any requests made to your localhost URL will also be made to the exposed URL and vice versa.
  • Your public URL will only be active as long as your local API or React Project is active.

Why Would You Want To Expose Your Localhost URL?

  • Working with Webhook: Webhooks require a public URL. Exposing your localhost URL generates a public URL for you. The Webhook request can be made to this public URL and your localhost URL will also receive the request. Check out this article to learn more about webhooks and how to use them with Python.
  • Testing your project on other devices: You might want to test your React project on an actual mobile or any other device.
  • Making your server accessible to others: Exposing your localhost URL will let anyone with the URL access it. This can help you to share your server/React project with others for feedback or debugging.

We will look at two free options to expose your localhost URL. The first option will require you to download software while the second option will require an NPM package.

Option 1: Ngrok

You will need to sign up for ngrok. After you sign up, you will have to download the software.

--

--

Rahul Banerjee
Rahul Banerjee

Written by Rahul Banerjee

Software Developer | Views are my own

Responses (1)

Write a response