# Web addresses

Each port of a VM gets an HTTPS web address, and its access level decides who may open it.

Source: https://slashinfra.com/docs/platform/web-addresses
Last modified: 2026-11-30T16:36:19.000Z

Each port of your VM gets an HTTPS web address, so a server you run there opens in a browser. A port starts `closed`: only members of your organization reach it, and you open it to share a link or make it public.

Figure: Each port has one setting: closed opens it to members, authenticated adds anyone with your link, public opens it to anyone.

## Open a port

Opening a port gives it an access level. `authenticated` accepts members and anyone with a link you make; `public` accepts anyone. Opening a port with the access it already has changes nothing and keeps its links.

The samples use a VM named `web` with a web server on port 3000. [VMs](https://slashinfra.com/docs/platform/vms) shows how to create the VM.

### Dashboard

- Open the [dashboard](https://app.slashinfra.com/svms) and select `web`. 
- Select the Ports tab. 
- Select Add port. 
- Enter `3000` in Port. 
- Choose Members and links in Access. 
- Select Add port.

### CLI

The first command starts a web server in `web` and prints its job number. The second opens port 3000 to members and links.

```bash
si job start -c 'cd /tmp && python3 -m http.server 3000' web
si port open web 3000 --auth
```

Output

```text
1
port 3000: authenticated
```

### curl

```bash
curl -sS -X PUT "https://api.slashinfra.com/svms/web/ports/3000" \
-H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \
-d '{"access":"authenticated"}'
```

Output

```text
{"port":3000,"access":"authenticated","url":"https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=..."}
```

### Python

```python
import os, requests

res = requests.put(
"https://api.slashinfra.com/svms/web/ports/3000",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
json={"access": "authenticated"},
)
res.raise_for_status()
print(res.json()["port"], res.json()["access"])
```

Output

```text
3000 authenticated
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/web/ports/3000', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.SI_API_KEY!}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ access: 'authenticated' }),
})
if (!res.ok) throw new Error(await res.text())
const port = (await res.json()) as { port: number; access: string }
console.log(port.port, port.access)
```

Output

```text
3000 authenticated
```

## Use the address from a client

Port 3000 of VM `web` has the address `https://3000-<id>.slashinfra.dev`, where `<id>` is the VM’s id. For a VM with id `6f1c0f0e8a`, that is `https://3000-6f1c0f0e8a.slashinfra.dev`.

On a preview host, send the API key in `X-Si-Authorization`, because the app keeps `Authorization` for itself. SlashInfra removes the header before the request reaches the VM.

A link adds `?si_access=` with a token. The first GET to a link answers 303 without the token and sets an access cookie, so a client that follows a link must keep cookies. A request that passes the access check wakes a sleeping VM. If the VM declares a readiness port, a request that waits on a wake is released when that port answers; set `readiness` on [VMs](https://slashinfra.com/docs/platform/vms). See [Sleep and wake](https://slashinfra.com/docs/how/sleep-and-wake).

```bash
curl -sS -o /dev/null -w '%{http_code}\n' \
-H "X-Si-Authorization: Bearer $SI_API_KEY" \
"https://3000-6f1c0f0e8a.slashinfra.dev/"
```

Output

```text
200
```

## List ports

List returns every open port of the VM with its access and a fresh link for each `authenticated` port. A port that is not in the list is `closed`; a `public` port has `url` as `null`.

### Dashboard

- Open the [dashboard](https://app.slashinfra.com/svms) and select `web`. 
- Select the Ports tab. The table lists each port under Port and its level under Who can open it.

### CLI

```bash
si port ls web
```

Output

```text
port  access         url
3000  authenticated  https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=...
```

### curl

```bash
curl -sS "https://api.slashinfra.com/svms/web/ports" \
-H "Authorization: Bearer $SI_API_KEY"
```

Output

```text
[{"port":3000,"access":"authenticated","url":"https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=..."}]
```

### Python

```python
import os, requests

res = requests.get(
"https://api.slashinfra.com/svms/web/ports",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
)
res.raise_for_status()
for port in res.json():
print(port["port"], port["access"])
```

Output

```text
3000 authenticated
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/web/ports', {
headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },
})
if (!res.ok) throw new Error(await res.text())
const ports = (await res.json()) as { port: number; access: string }[]
for (const port of ports) console.log(port.port, port.access)
```

Output

```text
3000 authenticated
```

## Make a presigned link

A link opens one port of one VM until it expires. The life is 3600 seconds by default and 2592000 seconds (30 days) at most on both plans. A link works for a `public` port too, but a public port needs none.

### Dashboard

- Open the [dashboard](https://app.slashinfra.com/svms) and select `web`. 
- Select the Ports tab. 
- Choose 7 days in Link lifetime. 
- Select Copy link on the `3000` row. The link is on your clipboard.

### CLI

```bash
si port url web 3000 --ttl 7d
```

Output

```text
https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=...
```

### curl

```bash
curl -sS -X POST "https://api.slashinfra.com/svms/web/ports/3000/url" \
-H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \
-d '{"ttl_s":604800}'
```

Output

```text
{"url":"https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=...","expires_at":1796562568000}
```

### Python

```python
import os, requests

res = requests.post(
"https://api.slashinfra.com/svms/web/ports/3000/url",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
json={"ttl_s": 604800},
)
res.raise_for_status()
print(res.json()["url"])
```

Output

```text
https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=...
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/web/ports/3000/url', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.SI_API_KEY!}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ ttl_s: 604800 }),
})
if (!res.ok) throw new Error(await res.text())
const link = (await res.json()) as { url: string }
console.log(link.url)
```

Output

```text
https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=...
```

## Rotate the links

Rotate makes a new generation of an open port. Every link to an `authenticated` port that was minted before the rotate stops working: a request with that link answers 401, including links you already shared. The port keeps its access, and the reply carries a fresh link when the port is `authenticated`.

### Dashboard

- Open the [dashboard](https://app.slashinfra.com/svms) and select `web`. 
- Select the Ports tab. 
- Select More actions on the `3000` row, then Rotate links. The dashboard says `Every link of port 3000 was invalidated`.

### CLI

```bash
si port rotate web 3000
```

Output

```text
rotated every link of port 3000
```

The command prints no link. `si port ls` or `si port url` shows the current one.

### curl

```bash
curl -sS -X POST "https://api.slashinfra.com/svms/web/ports/3000/rotate" \
-H "Authorization: Bearer $SI_API_KEY"
```

Output

```text
{"port":3000,"access":"authenticated","url":"https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=..."}
```

### Python

```python
import os, requests

res = requests.post(
"https://api.slashinfra.com/svms/web/ports/3000/rotate",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
)
res.raise_for_status()
print(res.json()["url"])
```

Output

```text
https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=...
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/web/ports/3000/rotate', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },
})
if (!res.ok) throw new Error(await res.text())
const port = (await res.json()) as { url: string }
console.log(port.url)
```

Output

```text
https://3000-6f1c0f0e8a.slashinfra.dev/?si_access=...
```

## Change who can open it

Open the port again with the other access. The change makes a new generation, so every link shared before the change loses its access. A `public` address needs no link, so the page still opens; an `authenticated` port needs a new link. The dashboard sets the access when you add a port and has no control to change it later.

### CLI

```bash
si port open web 3000 --public
```

Output

```text
port 3000: public
```

### curl

```bash
curl -sS -X PUT "https://api.slashinfra.com/svms/web/ports/3000" \
-H "Authorization: Bearer $SI_API_KEY" -H "Content-Type: application/json" \
-d '{"access":"public"}'
```

Output

```text
{"port":3000,"access":"public","url":null}
```

### Python

```python
import os, requests

res = requests.put(
"https://api.slashinfra.com/svms/web/ports/3000",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
json={"access": "public"},
)
res.raise_for_status()
print(res.json()["access"])
```

Output

```text
public
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/web/ports/3000', {
method: 'PUT',
headers: {
Authorization: `Bearer ${process.env.SI_API_KEY!}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({ access: 'public' }),
})
if (!res.ok) throw new Error(await res.text())
console.log(((await res.json()) as { access: string }).access)
```

Output

```text
public
```

Pass `--auth` or send `authenticated` to return the port to members and links.

## Close a port

Closing a port makes it `closed`: only members reach it, and every link of the port stops working at once, even after you open the port again. Closing an already closed port changes nothing.

### Dashboard

- Open the [dashboard](https://app.slashinfra.com/svms) and select `web`. 
- Select the Ports tab. 
- Select More actions on the `3000` row. 
- Select Delete. The dashboard offers Undo for 5 seconds, then closes the port.

### CLI

```bash
si port close web 3000
```

Output

```text
closed port 3000 of SVM "web"
```

### curl

```bash
curl -sS -i -X DELETE "https://api.slashinfra.com/svms/web/ports/3000" \
-H "Authorization: Bearer $SI_API_KEY"
```

Output

```text
HTTP/2 204
...
```

### Python

```python
import os, requests

res = requests.delete(
"https://api.slashinfra.com/svms/web/ports/3000",
headers={"Authorization": f"Bearer {os.environ['SI_API_KEY']}"},
)
res.raise_for_status()
print(res.status_code)
```

Output

```text
204
```

### TypeScript

```ts
const res = await fetch('https://api.slashinfra.com/svms/web/ports/3000', {
method: 'DELETE',
headers: { Authorization: `Bearer ${process.env.SI_API_KEY!}` },
})
if (!res.ok) throw new Error(await res.text())
console.log(res.status)
```

Output

```text
204
```

## Forward a port to your laptop

A forward listens on `127.0.0.1` on your laptop and carries each connection to a port of the VM. It uses your key, not the web address, so it works on a closed port, and the first connection wakes the VM. A forward counts toward the VM’s connection limit. Ctrl-C closes every forward.

```bash
si port forward web 3000
```

Output

```text
127.0.0.1:3000 -> SVM 6f1c0f0e8a:3000
Ctrl-C closes every forward
```

`si port forward web 3000 8000 5432:15432` forwards three ports; `5432:15432` listens on local port 15432 and reaches VM port 5432. `--stdio` carries one port between standard input and output for an SSH `ProxyCommand`; see [SSH](https://slashinfra.com/docs/platform/ssh).

## Options

| Field | Type | Default | Allowed values | What it changes |
| --- | --- | --- | --- | --- |   
| `ref` (path, `<SVM>`) | string | Required | A VM name, or its id | The VM whose port the request acts on. | 
| `port` (path, `<PORT>`) | integer | Required | 1 to 65535 | The port on the VM. | 
| `project` (`--project`) | string | `default` | A project name, or its `proj_` id | The project that holds the VM. | 
| `access` (`--auth`, `--public`) | string | Required | `authenticated` or `public`; the CLI opens `authenticated` unless you pass `--public` | Who may open the address. | 
| `ttl_s` (`--ttl`) | number | `3600` | 1 to 2592000 whole seconds (30 days); the CLI takes `30m`, `1h`, `7d` or seconds | The life of the link. | 
| `ports` (`<PORT[:LOCAL]>`) | string | Required | `PORT` from 1 to 65535, and `LOCAL` from 1 to 65535 when given | The ports to forward and the local ports where they listen. |

## States

| State | What it means for you | What you can do |
| --- | --- | --- |   
| `closed` (default) | Only members of the organization open the address. | Open the port to share a link or make it public. | 
| `authenticated` | Members and anyone with a link you make open the address. | Copy a link, rotate it, change the access, or close the port. | 
| `public` | Anyone with the address opens it; no link or key. | Treat the content as public, change the access, or close it. |

## Errors

| Code | When | Fix |
| --- | --- | --- |   
| [`invalid_port`](https://slashinfra.com/docs/reference/errors#invalid_port) | Any operation names a port outside 1 to 65535. | Send a port from 1 to 65535. | 
| [`invalid_access`](https://slashinfra.com/docs/reference/errors#invalid_access) | Open sends an access other than `authenticated` or `public`. | Send `authenticated` or `public`. | 
| [`invalid_ttl`](https://slashinfra.com/docs/reference/errors#invalid_ttl) | The link life is not a whole number from 1 to 2592000 seconds. | Send seconds in that range, or use `--ttl 7d`. | 
| [`public_ports_not_allowed`](https://slashinfra.com/docs/reference/errors#public_ports_not_allowed) | The plan does not include public ports. | Open the port as `authenticated`. | 
| [`port_limit`](https://slashinfra.com/docs/reference/errors#port_limit) | Open would make more than 50 open ports on the VM. | Close a port first. | 
| [`port_closed`](https://slashinfra.com/docs/reference/errors#port_closed) | A request to make a link or rotate names a port that is not open. | Open the port first. | 
| [`not_supported_by_image`](https://slashinfra.com/docs/reference/errors#not_supported_by_image) | The port is 22 or 6080 and the image lacks SSH or the desktop. | Use the default image. |

Errors that any request can return are in the [error catalog](https://slashinfra.com/docs/reference/errors).

## Permissions

| Operation | Who can | Key action |
| --- | --- | --- |   
| Open a port | Any member | `svm:write` | 
| List ports | Any member | `svm:read` | 
| Make a presigned link | Any member | `svm:read` | 
| Rotate the links | Any member | `svm:write` | 
| Change who can open it | Any member | `svm:write` | 
| Close a port | Any member | `svm:write` | 
| Forward a port | Any member | `svm:read` |

## Limits

- A VM has at most 50 open ports on both plans. An open above that answers 409 `port_limit`. 
- A port is a number from 1 to 65535. 
- A link lasts one hour by default and 30 days at most on both plans. 
- A link names one VM and one port; it does not authenticate another port. 
- A VM accepts 64 preview connections at once; more answer 429. 
- A preview connection closes after about 100 seconds without traffic. 
- Port 22 and port 6080 need the default image; a postgres VM answers 409 `not_supported_by_image`.

The full list is in [Limits](https://slashinfra.com/docs/reference/limits).

## Next

- [Who can reach your VM](https://slashinfra.com/docs/how/access): members, keys and the link access levels. 
- [Sleep and wake](https://slashinfra.com/docs/how/sleep-and-wake): a request to a web address wakes a sleeping VM. 
- [Services](https://slashinfra.com/docs/platform/services): keep the server running across a sleep.
