A TLS tunnel forwards encrypted traffic for a public host name on port 443 to a local TLS service. By default the encrypted connection passes straight through to your service, which presents its own certificate.
TLS, HTTP or TCP? #
All three can publish a service that uses encryption. They differ in who holds the certificate and in what the public address looks like.
| Question | HTTP tunnel | TLS tunnel | TCP tunnel |
|---|---|---|---|
| Public endpoint | https:// address without a port | Host name on port 443 | Host name and an assigned server port |
| Who presents the certificate | Localtonet | Your service by default. Localtonet if you choose so in SSL Mode. | Localtonet adds no certificate. Your service does whatever it does today. |
| Where TLS ends | At the Localtonet server | At your service in pass-through mode | Wherever your protocol ends it |
| Protocols | HTTP and WebSocket | Any protocol that runs over TLS | Any TCP protocol |
| HTTP options such as headers, path rewrite, Basic Authentication, SSO, WAF and the request inspector | Yes | No | No |
| URL types | Random subdomain, Custom subdomain, Custom domain | Random subdomain, Custom subdomain | Random subdomain, Custom subdomain |
| Free plan session limit | None | 30 minutes per session | 30 minutes per session |
- Choose HTTP for a normal website, API or webhook receiver. It is the least work.
- Choose TLS when your service must present its own certificate, when traffic must stay encrypted up to your device, or when a non-HTTP protocol over TLS should be reachable on port 443.
- Choose TCP when the protocol is not TLS from the first byte, or when clients cannot send a host name. A TCP tunnel is addressed by its port, a TLS tunnel by its host name.
Before you start #
- A current Localtonet client, connected with an AuthToken. The TLS page states the minimum versions: Desktop v7.6 and Mobile v9.9.
- A local service that speaks TLS and has a certificate for the host name clients will use. If your service has no certificate, see HTTP, or switch the SSL mode as described below.
- For Custom subdomain: Balance on your account.
Steps #
-
Open the TLS page #
Open My Tunnels › TLS and select Create TLS Tunnel to open the form.
-
Choose the URL type, the device and the region #
In URL type, select Random subdomain or Custom subdomain. In Device token, select the token used by the Localtonet app on your device. In Server region, choose a region close to your device.
-
Enter the endpoint #
Field What to enter Domain localto.net, or a domain you added in DNS Manager.Subdomain Only for Custom subdomain: the name in front of the domain. Letters, digits and hyphens are allowed. Local IP address Address of the service on your device. Use 127.0.0.1for this device.Local port The port your TLS service listens on, for example 443or8443.Select Create tunnel.
-
Start the tunnel #
Select the start button in the Actions column. The URL column shows the host name, and the Server Port column shows
443. Clients connect to that host name on port 443.
The endpoint #
- Every TLS tunnel is reached on port 443. The local port can be any port.
- Localtonet finds your tunnel by the host name that the client sends when it opens the TLS connection (SNI). Clients must therefore connect with the host name from the URL column. A connection to the server's IP address that does not carry this host name does not reach your tunnel.
- The host name stays the same when you stop and start the tunnel.
SSL mode: who handles the certificate #
Open the tunnel settings and select Manage next to SSL Mode. The dialog SSL mode asks who handles HTTPS for this tunnel.
| Choice | What happens | Use it when |
|---|---|---|
| My service handles HTTPS | Pass-through. Encrypted traffic passes straight through to your service, which must present its own certificate for this domain. Localtonet does not decrypt it. | You need your own certificate or end-to-end encryption. A new TLS tunnel starts in this mode. |
| Localtonet handles HTTPS | Localtonet provides and renews the certificate. Nothing to set up on your side. Localtonet ends the TLS connection and forwards the decrypted traffic to your service. | Your service has no certificate, but clients must reach it with TLS on port 443. |
Select Save. If the tunnel is running it restarts with the new mode, so the Localtonet app must be connected.
The setting Is SslStream? belongs to the second mode. Turn it on when Localtonet handles HTTPS and your local service still expects a TLS connection. Leave it off in pass-through mode, where the visitor's TLS connection already reaches your service unchanged.
Settings of a TLS tunnel #
| Setting | What it does | Read more |
|---|---|---|
| SSL Mode | Choose Localtonet-managed SSL or pass TLS traffic through to your own service. | This page, above |
| Is SslStream? | Enable TLS when your local service uses it. | This page, above |
| Legacy Connect? | Try this if the tunnel cannot connect with the normal method. | Settings reference |
| Tunnel IP | View the IPv4 and IPv6 addresses of the server. | Settings reference |
| IP Restriction | Control which client IP addresses can access this tunnel. | Access control |
| Expiration Date, Speed Limits, Bandwidth Limit, Bandwidth Usage, Bandwidth Traffic | Stop the tunnel on a date, cap its speed, cap its data, reset the data counter, and see the traffic over time. | Limits and expiration |
| Request Log, Activity Log, Tunnel Health | See the connections made to the tunnel, its starts, stops and setting changes, and the health checks. | Logs and inspection |
| Arguments | Send this tunnel through a specific network on your device. | Network selection |
| Outbound Port | Use fixed outbound ports for the Localtonet app's server connection, for strict firewalls. | Ports |
| Tunnel Note | Save a private note to help you identify this tunnel. | Settings reference |
| Load Balance | Distribute traffic across devices or use a backup target. | Load balancing |
A TLS tunnel has no server port setting and no reserved port. The port is always 443.
Examples #
A web server with its own certificate #
Your web server listens on 127.0.0.1:443 and has a certificate for secure.example.com. You added example.com in DNS Manager and your account has Balance.
| Field | Value |
|---|---|
| URL type | Custom subdomain |
| Subdomain | secure |
| Domain | example.com |
| Local IP address | 127.0.0.1 |
| Local port | 443 |
Start the tunnel and open https://secure.example.com. The browser shows the certificate of your own server. You can check which certificate is presented with OpenSSL:
openssl s_client -connect <TUNNEL_HOST>:443 -servername <TUNNEL_HOST>A non-HTTP service over TLS #
A message broker on your device accepts TLS connections on local port 8883. Create a TLS tunnel with Local port 8883. Clients then connect to the host name of the tunnel on port 443 with TLS turned on. The client must send the host name (SNI), which TLS libraries do when you connect by name.
TLS on port 443 for a service without a certificate #
Create the tunnel to the plain port of your service, open SSL Mode and select Localtonet handles HTTPS. Clients connect with TLS and receive a certificate from Localtonet. Your service keeps receiving unencrypted traffic.
On the Free plan #
TLS tunnels stop after 30 minutes on the Free plan. Select Start to begin another session if you have monthly bandwidth left. The host name does not change. See Plans and Balance.
Troubleshooting #
Clients show a certificate warning
In pass-through mode clients see the certificate of your own service. It must be valid for the host name of the tunnel and trusted by the client. Install a matching certificate on your service, or switch SSL Mode to Localtonet handles HTTPS.
The connection closes right after it opens
In pass-through mode your local service must answer the TLS handshake itself. If the service on the local port speaks plain HTTP or plain TCP, either switch SSL Mode to Localtonet handles HTTPS or use an HTTP or TCP tunnel. Also check that Is SslStream? is off in pass-through mode.
"Start or update the Localtonet app."
The tunnel could not be started on the device. TLS tunnels need Localtonet Desktop v7.6 or Mobile v9.9 or later. Update the client from the Downloads page and start the tunnel again.
"Check the device connection."
You saved SSL Mode or another setting that restarts a running tunnel while the Localtonet app was offline. Connect the app and save again, or stop the tunnel first.
"You need to purchase balance to use this feature."
Custom subdomain needs Balance. Use Random subdomain, or add Balance under Balance.
The tunnel stopped after half an hour
That is the Free session limit. The stopped tunnel shows Session ended in the list. Start it again, or add Balance to remove the limit.