26 min read

Expose Localhost To Internet (How To Get Started)

In this article, we will discuss how to use Localtonet to expose your local web server to the internet using a public URL.

A local web application connects through an HTTP tunnel to a public URL opened on a remote phone.
An HTTP tunnel routes public requests to a web application running on localhost.
Developer Guide ยท Localhost Tunneling ยท Localtonet ยท 2026

Publish a local web application through a temporary public HTTPS address

A service listening on localhost is intentionally reachable only from its own machine. Localtonet lets you make that service available through a public URL by connecting the client on your device to one of our relay servers. This guide explains the networking model, prerequisites, installation considerations, HTTP tunnel setup, verification, security, routine operation, and troubleshooting. You do not need inbound router port forwarding, firewall changes, VPN setup, or a public IP address.

๐Ÿ”’ Outbound client connection ๐ŸŒ Public HTTPS endpoint โšก No inbound port forwarding

Why localhost is not reachable from the internet

Diagram showing a remote request stopped at NAT while localhost remains inside the local computer.
Localhost is bound to the local machine and is not directly reachable through the router from the public internet.

The name localhost normally resolves to the loopback address 127.0.0.1 for IPv4 or ::1 for IPv6. Loopback traffic remains on the device that generated it. If an application is listening at 127.0.0.1:8080, a browser on that same computer can connect to it, but another computer cannot use its own 127.0.0.1:8080 to reach your application. On the other computer, that address refers back to the other computer.

Private network addresses such as those commonly assigned to laptops, desktops, virtual machines, and development boards are also not directly routable from the public internet. A home or office router generally uses Network Address Translation, or NAT, to let multiple private devices share an internet connection. Outbound connections work because the router can associate each response with the device that initiated the connection. Unsolicited inbound traffic has no equivalent mapping unless an administrator deliberately configures one.

Traditional inbound exposure often requires router port forwarding, a suitable public IP address, firewall rules, and continuing network administration. Those requirements can be unavailable on shared, corporate, mobile, hotel, or carrier-grade NAT networks. Opening an inbound port can also expose more of the network than intended when it is configured incorrectly.

With Localtonet, the connection starts in the opposite direction. The Localtonet client runs on a device that can reach your local application and establishes an outbound connection to a Localtonet relay server. An external visitor connects to the public address assigned to the tunnel. The relay sends the request through the established connection to the client, and the client forwards it to the configured local IP address and port.

๐Ÿ’ป Local service Your web application continues listening on its normal local IP address and port, such as 127.0.0.1:8080.
๐Ÿ”— Outbound client connection The Localtonet client connects outward from the device to the selected relay. No unsolicited inbound router connection is required.
๐ŸŒ Public endpoint The HTTP tunnel provides a public HTTPS address that external browsers and services can request while the tunnel is available.
โฑ๏ธ Explicit lifecycle Creating a tunnel saves its configuration. It does not start the tunnel. The selected client must be connected and the tunnel must be started separately.

The request path can be summarized as: external browser or service, public Localtonet HTTPS endpoint, Localtonet relay, the client's outbound connection, and finally the configured local service. Responses return through the same path.

A tunnel is not a VPN

An HTTP tunnel publishes the specific web target you configure. It does not place a visitor inside your private network. Localtonet VPN Manager is the separate product feature for private mesh VPN use cases.

Prerequisites before exposing localhost

Confirm the following items before creating a tunnel. Most setup failures come from an application that is not actually running, an incorrect target address, or a client that is not connected.

  • A running HTTP application: Start the website, API, webhook receiver, development server, or other HTTP service that you want to publish.
  • The correct local IP address: If the application and Localtonet client run on the same operating system, this is often 127.0.0.1. If the application runs on another device, virtual machine, or container, use an address that the client can actually reach.
  • The listening port: Know the exact port used by the application, such as 3000, 5000, or 8080. These are examples only. Use the value reported by your application.
  • A Localtonet account: You need access to the dashboard to manage the client device and HTTP tunnel.
  • A device-specific AuthToken: The token identifies and authenticates the client device that will run the tunnel. Treat it as a credential.
  • A current Localtonet client: Install the supported client package presented for your operating system or deployment environment by the current Localtonet account and installation flow.
  • Permission to expose the application: Do not publish a company, customer, school, or shared-network service unless you are authorized to do so.
An AuthToken does not authenticate website visitors

The AuthToken identifies the Localtonet client device. It does not automatically require visitors to sign in to your local web application. Unless your application supplies suitable authentication and authorization, its public endpoint may be reachable by anyone who knows or discovers the URL.

Choose the target from the client's point of view

The local IP and port are evaluated from the device or container running the Localtonet client. This distinction is important. If both processes run directly on the same machine, the loopback address can be appropriate. If the client runs in Docker while the application runs on the host, 127.0.0.1 inside the client container refers to that container, not automatically to the host. Similarly, a client running in a virtual machine cannot use its own loopback address to reach an application running only on the host.

Before continuing, identify where each process runs and verify that the client environment has a valid network route to the application. Do not assume that an address that works in your host browser will also work from a container or separate device.

Install and authenticate the Localtonet client

Install the Localtonet client on the device that can reach the local service. Keep the client running during configuration and testing. The exact installer, package name, processor architecture, signing flow, and launch method can change as supported releases are updated, so use the current installation path shown by Localtonet rather than commands copied from an older article.

Environment What to confirm Important networking consideration
Windows Use the current Windows client and architecture offered through the official Localtonet installation flow. A target on the same Windows system can usually be reached through its local listening address and port.
Linux Use the current Linux package and instructions appropriate to the supported distribution and processor architecture. Run the client as a user with only the permissions it requires. Do not grant global write permissions to its executable.
macOS Use the current macOS package matching the machine architecture and follow the current signing or permission prompts. Confirm that the application is listening and that macOS security controls permit the client to make the required outbound connection.
Docker Use a Docker installation path only when it is offered by the current official Localtonet installation material. The client container needs a route to the application. Container loopback is not the host loopback.
Android Use an Android installation path only when it is currently offered through an official Localtonet channel. The Android device must remain able to reach the target service and maintain the client connection.

This article intentionally does not reproduce legacy download filenames, package URLs, Docker launch syntax, or platform-specific startup commands. The supplied current product evidence does not establish one stable command sequence for Windows, Linux, macOS, Docker, and Android. Prescribing old commands could install an obsolete binary, select the wrong architecture, or expose a token in shell history. Follow the current installation material presented by our platform for the selected client environment.

Do not use chmod 777

That mode grants unnecessary read, write, and execute permissions broadly. If the current official Linux or macOS package requires an executable permission change, grant only the executable access required by the intended account and follow the current package instructions. Do not make the client binary writable by every user.

Protect the device token during authentication

Authenticate the client using the device-specific token provided through your Localtonet account workflow. Never place a real AuthToken in an article, screenshot, public issue, source repository, shared terminal transcript, application log, or screen recording. Avoid command forms that embed the token directly where it could be retained in shell history, process listings, container history, or deployment logs.

After authentication, confirm in the dashboard that you are selecting the intended client device. Descriptive device naming can help prevent a tunnel from being assigned to the wrong workstation, but never use the token itself as a visible device label.

Verify the application locally before tunneling

A tunnel can forward requests only to a service that already responds. Test the application locally before changing anything in the Localtonet dashboard. This separates application problems from tunnel problems and gives you a known-good response to compare with the public result.

Test in a browser

On the device running the application, open its exact local address, for example:

http://127.0.0.1:8080

Replace the example port with the actual port reported by your application. The expected result is the application's home page, API response, health page, or other intended content. A browser error at this stage means the local service must be fixed before creating the tunnel.

Inspect the HTTP response

If curl is already available in your environment, you can inspect the response headers without introducing any Localtonet-specific command:

curl -i http://127.0.0.1:8080/

A successful application may return 200 OK, a redirect such as 301, 302, 307, or 308, or another status intentionally produced by the route. A 404 can still prove that a server is listening, but it also indicates that the requested path is not defined. A connection-refused error generally means no service is listening at that address and port, or the service stopped before the request arrived.

Check the complete page, not only the first response

  • Confirm that stylesheets, scripts, fonts, and images load without local-only URLs.
  • Follow sign-in and application redirects to make sure they stay on the expected host.
  • Test API calls made by the browser after the initial HTML page loads.
  • If the application uses WebSockets, exercise the feature that opens the WebSocket connection.
  • Check the browser developer console for failed requests, blocked content, and host validation errors.
  • Confirm that the test does not expose real customer records, production credentials, or other sensitive data.

Test reachability from the client environment

When the Localtonet client and application run in different environments, test from the client's point of view. For example, an application listening only on the host's loopback interface may not be reachable from a separate container or virtual machine. You may need to adjust the application's bind address or networking arrangement, but do so narrowly and only within a trusted local environment. Do not make broad firewall or network changes simply to mask an incorrect target.

Create and start an HTTP tunnel

Localtonet console showing a connected HTTP tunnel from a public example URL to a local client port.
A connected console session lists the public endpoint, HTTP protocol, local address, port, and tunnel status.

After the application works locally and the intended Localtonet client is connected, configure the HTTP tunnel in the documented sequence below. The relay server selection must come from the current dashboard. Server codes and available regions can vary, so they should not be copied from an old tutorial or hardcoded into automation without consulting the current product.

1

Install and run the Localtonet client

Run the current supported client on the device that can reach your HTTP application. Keep the client connected while configuring and using the tunnel.

2

Authenticate or select the device

Authenticate the client with its device-specific AuthToken, then confirm that the intended device is available in your account. Do not disclose the token while completing this step.

3

Open the HTTP Tunnel page

Sign in and open the Localtonet HTTP Tunnel page in the dashboard.

4

Choose the Process Type

Select Random Sub Domain, Custom Sub Domain, or Custom Domain as applicable to your account and intended address. All three process types publish the configured HTTP content at a public HTTPS address.

5

Select the AuthToken and an available server

Select the token belonging to the connected client device, then choose an available relay server from the current dashboard. Do not guess or hardcode a server value.

6

Enter the local IP address and port

Enter the address and port that the selected client can use to reach the application. A same-device service might use 127.0.0.1 and its actual listening port, but containers, virtual machines, and remote LAN targets may require a different reachable address.

7

Create the tunnel

Create the tunnel to save its configuration. Creation alone does not make the public endpoint active.

8

Start the tunnel from the list

Locate the created tunnel in the tunnel list and press Start. The public endpoint works only while the selected client is connected and this tunnel is running.

Understanding the Process Type choices

Process Type Public address behavior When to consider it
Random Sub Domain Uses a generated public HTTPS address. Useful when you need an address without configuring your own domain.
Custom Sub Domain Uses a selected subdomain where the option is currently available. Useful when you need a more recognizable Localtonet-hosted address.
Custom Domain Uses a domain you own after completing the required domain and DNS configuration. Useful when an integration or repeatable workflow needs an address under your own domain.

Custom-domain configuration has additional ownership and DNS requirements. Follow our separate Localtonet custom-domain guide rather than guessing DNS records or nameserver settings. Availability and related options can vary by the current account or plan, so confirm them in the dashboard before designing a workflow around a specific address.

Create and Start are separate actions

A tunnel configuration can exist while it is stopped. If the public address does not respond, confirm both parts of the lifecycle: the selected client device is connected, and the tunnel itself has been started from the list.

Verify the public URL from another device or network

Once the tunnel is started, copy the assigned public URL without exposing your AuthToken or unrelated account information. Test the URL from a device that is not relying on the application's local loopback connection. A phone using mobile data, a separate computer, or an approved external test service can provide a more realistic check than opening both URLs on the development machine.

Perform a basic public request

Open the public HTTPS URL in a private browser window or on another device. The expected result should match the local application closely. If the local page works but the public page does not, the difference helps narrow the problem to client connectivity, tunnel state, target reachability, host validation, redirects, or browser security behavior.

You can also inspect the public HTTP response if your test environment has curl:

curl -i https://your-assigned-public-host.example/

The hostname above is deliberately a placeholder, not a real Localtonet endpoint. Substitute the exact public URL shown for your tunnel. Never substitute an AuthToken into a public request command.

Use an end-to-end verification checklist

  • Status and body: Confirm that the public route returns the intended status code and content rather than a tunnel error, framework error, or unrelated default page.
  • Static assets: Verify that CSS, JavaScript, images, and fonts load from valid public or relative URLs.
  • Redirects: Follow authentication, trailing-slash, and canonical-host redirects. A redirect back to localhost will fail for external users.
  • Forms and APIs: Submit a harmless test request and verify that browser-side API calls use the public origin where required.
  • WebSockets: Exercise live updates, hot reload, chat, dashboards, or other features that establish WebSocket connections.
  • Host restrictions: Check whether the framework rejects the public hostname. Development servers commonly restrict accepted hosts as a security measure.
  • HTTPS behavior: Inspect the browser console for mixed-content failures caused by an HTTPS page requesting an insecure HTTP resource.
  • Authorization: Test with a signed-out browser to understand what an unauthenticated visitor can access.

For webhook testing, send a non-sensitive test event from the provider and confirm that your local handler receives it. Validate any signature or secret required by that provider. A public URL does not prove that an incoming webhook is authentic.

Operate and close the tunnel safely

A Localtonet tunnel is available only while its selected client is connected and the tunnel is running. Closing the client, disconnecting the device, losing network access, putting a laptop to sleep, or stopping the tunnel interrupts public access. Creating a tunnel does not guarantee that it will automatically resume after a device or client restart.

After any restart, inspect the current client and tunnel status rather than assuming the endpoint is active. If you need unattended or automatic startup behavior, use only a currently documented installation and service configuration for your environment. Do not infer startup behavior from an older package or an unrelated operating system.

Stop versus delete

  • Stop: Use Stop when you want to make the endpoint unavailable while retaining the tunnel configuration for possible later use.
  • Delete: Delete the tunnel when you no longer need its saved configuration. Deletion is appropriate for obsolete experiments and helps reduce accidental reuse.
  • Close promptly: Stop temporary development tunnels immediately after a demo, webhook test, mobile-device check, or collaboration session.

Respond to a disclosed AuthToken

If a token appears in a screenshot, command history, repository, log, support attachment, or public message, treat it as disclosed. Remove the exposed copy where possible, revoke or rotate the affected device credential through the current Localtonet account workflow, and authenticate the intended client with the replacement. Review tunnel configurations associated with that device and stop anything that should not be running.

Do not rely on deleting the screenshot or repository commit alone. Copies may remain in caches, logs, forks, backups, or message history. Replacing the credential is the important containment step.

A development tunnel is not automatically a production deployment

A laptop-hosted development service may stop when the device sleeps, changes networks, restarts, or closes the client. Development frameworks can also expose debug output and use settings that are inappropriate for public traffic. Use a deliberately managed production environment when availability, monitoring, backups, maintenance, or formal operational controls are required.

Security practices for public localhost exposure

Diagram showing authentication, limited service scope, temporary exposure, and tunnel shutdown around a public localhost tunnel.
Public localhost exposure should be authenticated, narrowly scoped, temporary, and closed when no longer needed.

Publishing a local application changes its trust boundary. A service designed for one developer may now receive requests from the public internet. The safest approach is to expose only what is necessary, for the shortest practical time, with controls inside the application.

๐Ÿ” Authenticate users Require suitable application-level sign-in for pages, APIs, dashboards, and tools that are not intended for anonymous use.
๐Ÿ›ก๏ธ Authorize every action Authentication identifies a user. Authorization must still limit which records, routes, files, and administrative actions that user can access.
๐Ÿ“ฆ Use nonproduction data Prefer synthetic or sanitized test data. Avoid exposing production databases, customer records, private documents, or live payment credentials.
๐Ÿ”‘ Protect secrets Keep AuthTokens, API keys, session secrets, environment files, debug output, and provider webhook secrets out of pages, logs, screenshots, and repositories.
๐Ÿšซ Restrict admin interfaces Do not casually publish database consoles, debug toolbars, container dashboards, router panels, or framework administration routes.
โน๏ธ Stop when finished Keep temporary exposure temporary. Stop the tunnel after testing and delete configurations that no longer have a purpose.

Apply least privilege throughout the stack

Run the local application and Localtonet client with only the operating-system permissions they need. Use a dedicated non-administrative application account where practical. Limit database credentials to the development database and required operations. Do not disable framework host checks, cross-site request protections, or browser security controls globally just to make a demo work.

If a host allowlist must include the public hostname, add the specific expected hostname according to the framework's current documentation. Avoid wildcard host settings unless the application's security design explicitly requires and safely handles them.

Separate transport reachability from visitor trust

The public HTTPS URL gives external clients a network path to the application. That transport path does not determine who should be trusted. Application sessions, role checks, API authentication, webhook signatures, anti-forgery protections, input validation, and rate controls remain the application's responsibility.

Troubleshooting common localhost tunnel problems

The tunnel reports connection refused

Verify the local service first. Confirm that it is running, that the configured port matches the actual listening port, and that the configured IP address is reachable from the Localtonet client environment. A common mistake is entering 8080 when the application restarted on another port, or using 127.0.0.1 when the application is actually in a different container or machine.

The local page works, but the public URL is unavailable

Confirm that the correct Localtonet client is still connected. Then confirm that the tunnel was started after creation and remains running. Creating the record is not the same as starting it. Also verify that the tunnel references the token for the active device rather than an offline or old client.

The selected token or device does not connect

Make sure the token belongs to the intended device and was entered through the supported client authentication flow. Do not guess a token or reuse one that was revoked after disclosure. Restart the current client only through its supported platform workflow, then review its connection state in the dashboard.

The application is bound to the wrong address

A service bound only to 127.0.0.1 is reachable by processes sharing that network namespace, but not necessarily by another container, virtual machine, or LAN device. Review the application's bind setting and your environment's network boundaries. If you change it to listen beyond loopback, make the narrowest safe change and account for local firewall and network exposure.

A local firewall or endpoint policy blocks connectivity

Localtonet does not require you to open an inbound router port, but local security software can still affect the application's listening socket or the client's outbound connection. Check for a narrowly scoped local rule or organizational policy that blocks the relevant process. Do not disable the entire firewall. On managed devices, ask the network or security administrator before changing policy.

Docker cannot reach the host application

Inside a container, 127.0.0.1 points to that container. Determine whether the application runs in the same container, another container, or on the host. Configure a supported network route between them and use the address visible from the Localtonet client container. Avoid embedding AuthTokens directly in published Docker commands or image layers.

The framework rejects the public hostname

Some frameworks validate the HTTP Host header or maintain an allowed-host list. Add the exact public hostname using the framework's supported configuration, then restart the application if required. Do not solve the problem by accepting every possible host unless that behavior is intentionally secured and documented for your application.

Redirects lead back to localhost

Inspect the response's Location header and the application's external URL configuration. OAuth callbacks, login redirects, canonical URLs, and generated absolute links may still point to http://localhost. Configure the application or integration with the public HTTPS origin where appropriate, taking care not to commit temporary URLs or secrets into production configuration.

The browser reports mixed content

The public page uses HTTPS, but the application may generate browser requests beginning with http:// or ws://. Modern browsers can block insecure active content loaded by a secure page. Use relative URLs or the appropriate secure public scheme in browser-visible configuration. Do not disable browser security as a workaround.

WebSockets or live reload fail

First determine whether ordinary HTTP requests work. Then inspect the browser network panel for the WebSocket handshake, hostname, path, and scheme. The application must construct its WebSocket URL for the public host and secure browser context where applicable. Framework development servers may also apply origin or host checks to live-reload connections.

A custom domain does not resolve

Confirm that the domain was added and configured according to the current custom-domain setup guide. DNS changes are distributed through caches and can take time to propagate, in some cases up to 48 hours. Mixed old and new authoritative DNS settings can cause inconsistent resolution. Do not repeatedly change records while propagation is still in progress unless you have identified an actual configuration error.

The public page loads, but assets or APIs fail

Open the browser developer tools and inspect failed requests. Look for hardcoded localhost URLs, incorrect ports, cross-origin restrictions, blocked mixed content, missing routes, and redirects to an internal hostname. Compare the public request with the successful local request to isolate the difference.

Frequently asked questions

Do I need a public IP address or router port forwarding?

No. The Localtonet client establishes an outbound connection to a relay server. This lets the tunnel work without inbound router port forwarding, firewall changes, VPN setup, or a public IP address.

Does my AuthToken password-protect the public website?

No. The AuthToken identifies and authenticates the Localtonet client device. Your application must provide its own visitor authentication and authorization when anonymous access is not appropriate.

Why does localhost work in my browser but not through the tunnel?

The target must be reachable from the environment running the Localtonet client. If the client is in a container, virtual machine, or another device, its loopback address is different from the host application's loopback address. Also check the configured port, client connection, and tunnel running state.

Does creating an HTTP tunnel start it automatically?

No. Create saves the tunnel configuration. You must then press Start from the tunnel list. The endpoint is available only while the selected client is connected and the tunnel is running.

Can I use a custom domain instead of a generated address?

Localtonet HTTP tunnels support Random Sub Domain, Custom Sub Domain, and Custom Domain process types. Custom domains require separate domain and DNS configuration. Confirm current availability for your account and follow the dedicated custom-domain guide.

Will the public URL continue working after I close my laptop?

Not if closing or sleeping the laptop disconnects the selected client or stops the local application. The client must remain connected, the application must remain reachable, and the tunnel must remain running.

What should I do if I accidentally publish an AuthToken?

Treat it as disclosed. Remove visible copies where possible, revoke or rotate the affected credential through the current account workflow, authenticate the intended client with the replacement, and inspect associated tunnels. Do not assume deleting one screenshot or command is sufficient.

Is an HTTP tunnel suitable for an unattended production application?

A development tunnel does not by itself provide production operations such as application hardening, monitoring, backups, maintenance, or guaranteed device availability. Use a deliberately managed production environment when those requirements apply.

Expose your local HTTP service with Localtonet

Verify your application locally, connect the intended client device, create an HTTP tunnel, and start it when you are ready to test the public URL. Protect the application with appropriate access controls and stop the tunnel as soon as the testing session is complete.

Get Started Free โ†’

Corrections & updates

Substantive changes approved by the Localtonet editorial team are listed transparently below.

Rebuild the article using the current lt-* component structure and first-party Localtonet voice. Add a concise networking explanation of why localhost is not publicly routable and how the Localtonet client establishes an outbound connection to a relay without inbound router port forwarding, firewall changes, VPN setup, or a public IP. Add a clickable guide navigation card linked to real section IDs. Define prerequisites, including a running local HTTP service, its reachable IP and port, a Localtonet account, a device-specific token, a

Localtonet is a secure multi-protocol tunneling and proxy platform designed to expose localhost, devices, private services, and AI agents to the public internet supporting HTTP/HTTPS tunnels, TCP/UDP forwarding, mobile proxy infrastructure, file server publishing, latency-optimized game connectivity, and developer-ready AI agent endpoint exposure from a single unified control plane.

support