> ## Documentation Index
> Fetch the complete documentation index at: https://docs.reliantlabs.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Share a localhost URL from a dev server on your machine

> Turn a dev server on a Reliant cloud machine into a link: get its URL with reliant preview-url, open it yourself, then make the port public or token-only.

By the end of this guide a dev server that you or an agent started on a cloud machine has a link you can open, and, if you choose, share with someone else. Each cloud machine has its own preview address: `https://<port>-<machine-id>.workspaces.reliantapi.com`. It points at whatever is listening on that port inside the machine.

A preview link starts private. Only you, and members of the organization that owns the machine, can open it after signing in. Sharing it means changing that port's access rule.

## Before you begin

* A [cloud machine](https://docs.reliantlabs.io/machines/cloud.md). On [your own computer](https://docs.reliantlabs.io/machines/your-computer.md) the port is already on your computer, so the URL is plain `http://localhost:<port>/` and there is nothing to share.
* A shell on that machine, either the agent's or a terminal.
* The `reliant` CLI, which is already installed on cloud machines.

**1. Start the dev server**

Use a port below 32768. Bind it to `127.0.0.1`, `localhost` or all interfaces, because the preview reaches the server through loopback.

```bash terminal theme={null}
python3 -m http.server 18517 --bind 127.0.0.1
```

Any server works the same way: `npm run dev`, a Go API, a docs site. Leave it running.

**2. Get its preview URL**

In a second shell on the same machine:

```bash terminal theme={null}
reliant preview-url 18517
```

On a cloud machine the URL goes to stdout, and a note about who can open it goes to stderr:

```text terminal theme={null}
https://18517-<machine-id>.workspaces.reliantapi.com
access: openable by the workspace owner (authenticated); make the port public to share beyond the owner
```

The URL is built on the machine and the command makes no network call. On a computer you connected yourself, the same command prints the loopback address. This is real output from such a machine, with the server above running:

```text terminal theme={null}
$ reliant preview-url 18517 --require-listening
http://localhost:18517/
```

`--require-listening` makes the command exit `1` while nothing is listening yet, which is useful as a readiness check in a script ([Preview a running app](https://docs.reliantlabs.io/cli/previews.md)).

**3. Open it yourself**

Open the URL in a browser where you are signed in to Reliant. No rule is needed: a port without a rule follows the machine's default, which is **Authenticated** unless you changed it.

An agent that finishes a task can post the same link: `reliant preview-url <port> --json` prints the URL, whether the port is listening, and `access_level`, which is `owner` on a cloud machine.

**4. Share the port**

In the app header, open the **Detected ports** menu, which appears once the machine reports a listening port. Click the lock next to the port to switch it to **Public**. Anyone with the link can then open it, without signing in.

For more control, open the machine in **Settings → Machines**. Under **Port Access**, enter the port, choose an **Access mode** and click **Add**:

| Access mode | Who can open the port |
| - | - |
| Public | Anyone with the URL, signed in or not |
| Authenticated | You and members of the organization that owns the machine |
| Token | Anyone who presents the token Reliant shows you once, when you add the rule |

A Token caller sends the token as `Authorization: Bearer <token>` or adds `?rlnt_access_token=<token>` to the URL. Copy it right away, because the app does not show it again.

**5. Check who can open it**

Open the URL in a private window that is not signed in to Reliant. A Public port loads, while an Authenticated or Token port refuses you. A change can take up to about 10 seconds to apply, because the preview proxy caches access decisions for that long.

**6. Make it private again**

Click **Public** in the **Detected ports** menu to switch the port back, or remove its rule under **Port Access**. A port without a rule returns to the machine's default. Then stop the dev server when you no longer need it.

> [!WARNING]
>
> The **Detected ports** menu also sets the **Default access for new ports**. Setting it to **Public** makes every listening port without a rule reachable by anyone who has its URL, including ports you open later. Leave it on Authenticated and make single ports public instead.

## What this does not do

* **It is not hosting.** The link works only while the machine is awake and the server is running. A suspended machine keeps its files but not its processes ([Waking and suspending](https://docs.reliantlabs.io/machines/cloud.md#waking-and-suspending)). To publish an app that stays up, deploy it ([App hosting](https://docs.reliantlabs.io/hosting/overview.md)).
* **There is no CLI for access rules.** `reliant preview-url` only prints the URL. You change who can open a port in the app.
* **It does not expose your own computer.** A connected machine's preview is its loopback address, reachable only from that computer. Only cloud machines get a `workspaces.reliantapi.com` address.

How the machine reaches Reliant without opening inbound ports is explained in [how a tool call reaches your machine](https://docs.reliantlabs.io/deep-dives/how-tool-calls-reach-your-machine.md). What runs on the machine and what leaves it is in the [daemon security model](https://docs.reliantlabs.io/deep-dives/daemon-security-model.md).

## Troubleshooting

> [accordion] warning: nothing detected listening on port N yet (URL printed anyway)
>
> The command checks only for listeners bound to loopback or all interfaces, and it skips the kernel's ephemeral port range, 32768–60999 on most Linux systems. Check that the server has started, that it is not bound to one specific non-loopback address, and that its port is below 32768. The URL is still correct. Only the check is affected.

> [accordion] nothing is listening on port N yet
>
> You passed `--require-listening` and the check found no listener. The same causes apply as for the warning above.

> [accordion] The URL is [http://localhost:…](http://localhost:…)
>
> You ran the command on a computer you connected yourself, not on a cloud machine. Only cloud machines have a shareable preview address.

## Next steps

> [card] [Preview a running app](https://docs.reliantlabs.io/cli/previews.md)
>
> Every `preview-url` flag and its output.

> [card] [Start, stop and resize cloud machines](https://docs.reliantlabs.io/guides/machines/manage-cloud-machines-cli.md)
>
> Manage the machine itself from a terminal.

> [card] [Cloud machines & plans](https://docs.reliantlabs.io/machines/cloud.md)
>
> Sizes, idle timeouts and what survives a suspend.

> [card] [Daemon security model](https://docs.reliantlabs.io/deep-dives/daemon-security-model.md)
>
> What an agent's commands can reach on the machine.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.