# Exposed ports

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/air/llms.txt).

Expose a port when you want to open a server that runs inside the cloud environment – a dev server, an API, or a preview build – from your browser.

The agent often starts a server in the cloud environment: a dev server, a preview build, or an API the tests call. Such a server listens inside the container, so a `localhost` address means nothing on your machine. Instead, Air Teams publishes each exposed port at its own public URL. Only HTTP is supported.

Use Exposed ports to list the ports the environment publishes. Enter them as a comma-separated list, for example `3000, 5173`. Each port must be in the range 1–65535.

By default, the environment exposes ports 3000, 8000, and 8080, which cover most dev servers. Change the list when your project serves on a different port, for example, 5173 for a Vite dev server or 4200 for Angular.

List only the ports you need. An environment has a fixed bandwidth budget for exposed-port traffic and the ports share it equally, so each extra port leaves the others with less.

> **Warning:**
> Anyone who has the URL can reach the port. Air Teams puts no authentication in front of it, so expose a port only when the service behind it controls access itself.

## Make the server reachable

Exposing the port is not enough on its own. The server also has to accept a request that arrives from outside the container:

* Listen on `0.0.0.0` – a server bound to `127.0.0.1` accepts connections only from inside the container, so the public URL returns nothing.

* Accept the public hostname – the request reaches the server with the public hostname in the `Host` header, and a framework that checks that header rejects a host it doesn't know. Allow the host in the framework's own setting, for example, `server.allowedHosts` in Vite or `allowedHosts` in the Angular dev server.

Absolute URLs the server generates itself – hot-reload sockets, redirects, asset links – have to point at the public origin too, not at `localhost`.

## Find the public URL of a port

Inside the environment, each exposed port gets an environment variable named `JBCENTRAL_EXPOSED_PORT_URL_<port>` that holds the full URL. Ask the agent to print the one you need:

```BASH
            
echo $JBCENTRAL_EXPOSED_PORT_URL_3000

```

Air Teams sets these variables when the environment starts, and a resumed task gets the same values, so the URL stays valid for the whole task. The agent session and [.air/cloud/startup.sh](startup-commands.html#cloud_startup_script) both read them, so the script can point a config file or a framework setting at the public URL before the server starts.

