# Port Reference

Use this reference to plan firewall rules, security groups, Kubernetes Services, and load balancers for AISIX gateways and AISIX Enterprise control-plane components.

The tables distinguish defaults from required or example values. Use the values from the deployed startup configuration, Kubernetes Service, or generated control-plane installation instructions when they differ from the examples.

Start with the gateway ports for any deployment. If the gateway connects to AISIX Enterprise or AISIX Cloud, also review [Control-Plane Gateway Connectivity](#control-plane-gateway-connectivity). For an AISIX Enterprise deployment, review [AISIX Enterprise Control-Plane Ports](#aisix-enterprise-control-plane-ports) as well.

## AISIX Gateway Ports[​](#aisix-gateway-ports "Direct link to AISIX Gateway Ports")

Every AISIX gateway serves caller traffic on the proxy listener. With etcd or a control plane as the resource source, it binds that listener only after applying its first configuration, so the port is closed until then; see [Startup and the First Configuration](https://docs.api7.ai/ai-gateway/deployment/health-checks.md#startup-and-the-first-configuration). An open-source AISIX gateway can also bind an admin listener; a gateway connected to AISIX Enterprise or AISIX Cloud does not. Outbound requirements depend on the gateway's configuration source and configured runtime destinations.

| Listener or Connection            | Configuration                                  | Address or Port Behavior                                                                                                                                                                                                                             | Traffic and Purpose                                                                                                                                                                                            | Exposure                                                                                                                                                                                                                                                    |
| --------------------------------- | ---------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Proxy listener                    | `proxy.addr`, or `proxy.listeners` for several | Required; the example configuration uses `0.0.0.0:3000`. `proxy.listeners` replaces it with an explicit set of listener addresses. With etcd or a control plane as the resource source, not bound until the gateway applies its first configuration. | Inbound caller-facing AI APIs and the `/livez` and `/readyz` health routes.                                                                                                                                    | Expose only to intended callers or the ingress tier in front of the gateway.                                                                                                                                                                                |
| Admin listener                    | `admin.addr`                                   | Defaults to the unusable address `127.0.0.1:0`; the example configuration uses `127.0.0.1:3001`.                                                                                                                                                     | Inbound to an open-source AISIX gateway for the read-only [gateway Admin API](https://docs.api7.ai/ai-gateway/reference/admin-api.md), its OpenAPI document and Scalar UI, the playground, and health routes. | Keep private or bound to loopback. Authenticated resource reads can return sensitive configuration, while health and OpenAPI discovery routes are unauthenticated. This listener is not bound when the gateway connects to AISIX Enterprise or AISIX Cloud. |
| Metrics and status listener       | `observability.metrics.prometheus.addr`        | Defaults to `0.0.0.0:9090` when Prometheus metrics are enabled.                                                                                                                                                                                      | Inbound for the configured Prometheus path and `/status/config`, `/status/ready`, and `/status/models`.                                                                                                        | Keep private to Prometheus and operations systems. These routes do not require application authentication.                                                                                                                                                  |
| Diagnostics listener              | `observability.debug.addr`                     | Defaults to `127.0.0.1:9091`; enabled by default.                                                                                                                                                                                                    | Inbound for `GET /debug/pprof/heap`, which returns a heap profile of the gateway process.                                                                                                                      | Keep on loopback and reach it through `kubectl port-forward` or from the host. The route does not require authentication, and each request costs seconds of CPU.                                                                                            |
| etcd                              | `etcd.endpoints`                               | No default; external etcd commonly uses client port `2379`.                                                                                                                                                                                          | Outbound from an open-source AISIX gateway that loads dynamic resources from etcd.                                                                                                                             | Keep etcd private to AISIX and the systems that manage gateway configuration. This connection is not used with a resources file.                                                                                                                            |
| Control-plane management          | `managed.cp_base_url`                          | No default; an HTTPS URL without an explicit port uses `443`.                                                                                                                                                                                        | Outbound for registration, heartbeat, telemetry, and certificate rotation.                                                                                                                                     | Allow gateways to initiate connections to the configured endpoint. The control plane does not initiate connections to gateway hosts.                                                                                                                        |
| Control-plane configuration store | `managed.cp_etcd_endpoint`                     | When unset, the gateway uses the host and port from `managed.cp_base_url`.                                                                                                                                                                           | Optional outbound connection to a separate control-plane configuration-store endpoint.                                                                                                                         | Allow the configured port only when the generated installation configuration supplies this endpoint.                                                                                                                                                        |

Runtime destinations do not share default ports. When building an egress allowlist, permit every endpoint named in the gateway's startup or resource configuration. This includes model providers, guardrail services, MCP servers, A2A agents, OIDC issuers, Redis backends, and telemetry exporters.

## Configure AISIX Gateway Ports[​](#configure-listener-ports "Direct link to Configure AISIX Gateway Ports")

The startup configuration defines the gateway listener ports and, for an open-source AISIX gateway that uses etcd, the external etcd endpoint. For a gateway connected to AISIX Enterprise or AISIX Cloud, use the management endpoints in the generated installation instructions; see [Control-Plane Gateway Connectivity](#control-plane-gateway-connectivity).

Set the proxy listener with `proxy.addr`. This declares one listener:

```
proxy:

  addr: "0.0.0.0:3000"
```

Set `proxy.listeners` to declare several proxy listeners instead, each with its own port and its own optional TLS. A non-empty list is the complete set of proxy listeners: only these addresses are bound, `proxy.addr` is not, and `proxy.tls` must be absent:

```
proxy:

  addr: "0.0.0.0:3000"

  listeners:

    - addr: "0.0.0.0:3443"

      tls:

        cert_file: "/etc/aisix/tls/proxy.crt"

        key_file: "/etc/aisix/tls/proxy.key"

    - addr: "0.0.0.0:3000"
```

Every listener serves the same routes, including the `/livez` and `/readyz` health routes, so plan firewall rules for each address in the list. See [Serve HTTPS and HTTP at the Same Time](https://docs.api7.ai/ai-gateway/deployment/tls-and-mtls.md#serve-https-and-http-at-the-same-time).

The proxy listener address is required in startup configuration, and stays required when `proxy.listeners` names the set. Each address that the gateway will bind is checked at startup whichever resource source is in use — the gateway binds it once and releases it again, and loads any TLS material configured for it — so an address already taken at that point, or a certificate file it cannot read, fails the boot rather than a later moment. The address is not held during the wait, so a port taken by something else while the gateway waits still fails when the real bind happens. The listener itself is bound immediately with a resources file, and only after the first configuration is applied with etcd or a control plane; see [Startup and the First Configuration](https://docs.api7.ai/ai-gateway/deployment/health-checks.md#startup-and-the-first-configuration).

For an open-source AISIX gateway, `admin.enabled` defaults to `true`. To expose the read-only gateway Admin API, override the unusable default `admin.addr` value of `127.0.0.1:0` with a private or loopback address and configure at least one `admin.admin_keys` value. Set `admin.enabled` to `false` to disable the listener. A gateway connected to AISIX Enterprise or AISIX Cloud never binds this listener, regardless of these settings.

Set `observability.metrics.prometheus.addr` to change the dedicated metrics and status listener address. This listener runs when Prometheus metrics are enabled and defaults to `0.0.0.0:9090`:

```
observability:

  metrics:

    prometheus:

      enabled: true

      path: "/metrics"

      addr: "0.0.0.0:9090"
```

The metrics/status listener also serves `/status/config`, `/status/ready`, and `/status/models`. These operational routes are unauthenticated. Bind the listener to a private interface or restrict it with network policy or firewall rules.

The diagnostics listener binds `127.0.0.1:9091` by default. Set `observability.debug.enabled` to `false` to turn it off, or `observability.debug.addr` to move it. The gateway logs a warning at startup when the address is not a loopback address, and logs an error and keeps serving traffic when the address cannot be bound. See [Memory Diagnostics](https://docs.api7.ai/ai-gateway/observability/memory-diagnostics.md#configure-memory-diagnostics).

For an open-source AISIX gateway that uses etcd, configure every endpoint with its actual client port:

```
etcd:

  endpoints:

    - "https://etcd.internal.example:2379"
```

Use mTLS when the etcd connection crosses a host or network trust boundary. See [TLS and mTLS](https://docs.api7.ai/ai-gateway/deployment/tls-and-mtls.md#configure-etcd-mtls).

## Control-Plane Gateway Connectivity[​](#control-plane-gateway-connectivity "Direct link to Control-Plane Gateway Connectivity")

Gateways initiate all management connections to AISIX Enterprise or AISIX Cloud. The control plane does not initiate connections to gateway hosts, and live caller traffic does not pass through it.

For AISIX Cloud, API7 hosts the control plane. Allow outbound TCP connections from each gateway to the exact management and configuration-store endpoints in the generated installation instructions. Do not create an inbound control-plane-to-gateway firewall rule.

For AISIX Enterprise, gateways connect to the `dp-manager` endpoint over mTLS. Make that endpoint reachable from every gateway host or cluster. Set its gateway-reachable address with `AISIX_CLOUD_DPMGR_BASE_URL` for Docker Compose or `api.dpmgrBaseURL` for Helm. The control plane puts this address into generated gateway installation instructions and uses its host in the `dp-manager` server certificate.

## AISIX Enterprise Control-Plane Ports[​](#aisix-enterprise-control-plane-ports "Direct link to AISIX Enterprise Control-Plane Ports")

In an AISIX Enterprise deployment, browser and Admin API traffic use a different entry point from gateway management traffic. Keep database traffic on the deployment network.

| Default Port | Component                  | Purpose                                                                                                                                                                    | Exposure                                                                                                               |
| ------------ | -------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| `8080`       | `cp-api`                   | Browser-facing dashboard entry point and AISIX Cloud Admin API. `cp-api` serves the dashboard itself.                                                                      | Expose through the intended control-plane origin. Use a TLS-terminating reverse proxy or load balancer for production. |
| `7944`       | `dp-manager`               | mTLS endpoint used by gateways for registration, configuration delivery, heartbeat, and telemetry. HTTPS APIs and the configuration-store protocol share this port.        | Expose only to networks that run AISIX gateways. Preserve end-to-end TLS to `dp-manager`.                              |
| `5432`       | PostgreSQL                 | Database traffic from `cp-api` and `dp-manager`.                                                                                                                           | Keep private to the control-plane services and database administrators.                                                |
| `7946`       | `dp-manager` health server | Plain-HTTP `/healthz` listener. The default Helm deployment uses it for Kubernetes probes; Docker Compose does not publish it. It is not part of the `dp-manager` Service. | Keep inside the pod or container network. Do not publish to gateway or operator networks.                              |

### Control-Plane Egress[​](#control-plane-egress "Direct link to Control-Plane Egress")

Some control-plane features initiate outbound connections from `cp-api`. Their ports come from the configured destination URLs rather than from fixed AISIX defaults.

| Destination                                                  | When Required                                                                                                                                          |
| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Configured LLM endpoints                                     | Dashboard playground and semantic-routing test requests.                                                                                               |
| Configured webhook or Slack destinations                     | Budget notification delivery.                                                                                                                          |
| `https://models.dev/api.json` or `AISIX_CLOUD_PRICESYNC_URL` | Online model-pricing synchronization. The packaged Docker Compose deployment uses an offline snapshot by default and does not require this connection. |

For a default-deny egress policy, allow the destination port for each enabled feature. HTTP and HTTPS URLs use ports `80` and `443`, respectively, when the URL does not specify a port.

### Docker Compose Port Mappings[​](#docker-compose-port-mappings "Direct link to Docker Compose Port Mappings")

Docker Compose publishes the following container ports on the host. Changing a host binding does not change the corresponding container port.

| Variable             | Default Host Binding | Container Port |
| -------------------- | -------------------- | -------------- |
| `API_HOST_PORT`      | `8080`               | `8080`         |
| `DPM_HOST_PORT`      | `7944`               | `7944`         |
| `POSTGRES_HOST_PORT` | `127.0.0.1:5432`     | `5432`         |

The default `API_HOST_PORT` and `DPM_HOST_PORT` values bind to all host network interfaces. Prefix a value with `127.0.0.1:`, such as `127.0.0.1:8080`, to restrict a local-only deployment to loopback. When a gateway runs on another host or cluster, expose the `dp-manager` endpoint at the hostname and port in `AISIX_CLOUD_DPMGR_BASE_URL`.

Two of these host ports are also named by a URL setting. When you move a service to another host port, change the port in its URL setting as well:

* With `API_HOST_PORT`, change `AISIX_CLOUD_PUBLIC_BASE_URL`, for example `API_HOST_PORT=48080` with `AISIX_CLOUD_PUBLIC_BASE_URL=http://localhost:48080`. The control plane accepts sign-in only from the origin of that URL, its loopback twin, and the origins in `AISIX_TRUSTED_ORIGINS`, so a sign-in from any other address is refused with `INVALID_ORIGIN`. See [Trusted Sign-In Origins](https://docs.api7.ai/ai-gateway/on-premises/deployment.md#trusted-sign-in-origins).
* With `DPM_HOST_PORT`, change `AISIX_CLOUD_DPMGR_BASE_URL`. It is the address that the dashboard's gateway deployment command gives a gateway, so a gateway deployed with the old port cannot reach `dp-manager`.
* `POSTGRES_HOST_PORT` has no paired URL setting.

Leave a URL unchanged when it is the address of a reverse proxy or another host rather than this host's port.

You can also pass the host ports and paired URLs on the command line. For example, change the API and dp-manager host ports together:

```
API_HOST_PORT=48080 DPM_HOST_PORT=47944 ./run.sh
```

How the value persists depends on whether `.env` already exists:

| Installation state | What `run.sh` does                                                                                                                                                                                                                                                                                                                                                                                                                                   |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Fresh installation | Writes every supplied port and URL into the new `.env`. A supplied URL is written unchanged. An omitted `localhost` dashboard URL follows the supplied API port, so the example writes `AISIX_CLOUD_PUBLIC_BASE_URL=http://localhost:48080`. The shipped dp-manager placeholder also follows the supplied DPM port, becoming `https://<your-dp-manager>:47944`; replace its host before connecting a gateway. Later plain runs use the saved values. |
| Existing `.env`    | Applies command-line ports and URLs to that run only. It does not rewrite `.env` or either URL. When `.env` lacks a supplied value, the script prints the exact line to add before a later plain run.                                                                                                                                                                                                                                                |

The script also explains common port and URL mismatches:

| Output                             | Meaning and action                                                                                                                                                                                                                                                                         |
| ---------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Host port already in use           | The error names the paired URL setting and its current value. Choose another port, update the paired URL when it points at this host, and run the script again.                                                                                                                            |
| Loopback URL uses a different port | After startup, the script warns when a `localhost`, `127.0.0.1`, or `[::1]` URL does not match the published port and prints the exact `.env` lines to set. For a mismatched public base URL, the startup message shows only the published port rather than an unusable dashboard address. |
| URL points at another host         | The script treats it as intentional and does not warn. A public base URL on another host is printed as the dashboard address.                                                                                                                                                              |

### Helm Service Ports[​](#helm-service-ports "Direct link to Helm Service Ports")

The default Helm chart creates `ClusterIP` Services. Publish only the services that clients outside the cluster need.

| Helm Values                                                    | Defaults                   | Consumers                                                                              |
| -------------------------------------------------------------- | -------------------------- | -------------------------------------------------------------------------------------- |
| `api.service.type`, `api.service.port`, `api.service.nodePort` | `ClusterIP`, `8080`, empty | Operators, browsers, and Admin API clients through the configured control-plane origin |
| `dpm.service.type`, `dpm.service.port`, `dpm.service.nodePort` | `ClusterIP`, `7944`, empty | AISIX gateways                                                                         |
| `postgresql.primary.service.ports.postgresql`                  | `5432`                     | Control-plane services inside the cluster                                              |

For the API and data-plane manager Services, the chart uses a configured `nodePort` only when the Service type is `NodePort`. Leave the value empty to let Kubernetes allocate a port dynamically. The chart ignores it for other Service types.

Direct connections to the API NodePort use plain HTTP. For production access, place it behind a TLS-terminating proxy or load balancer. `cp-api` serves both the dashboard and the Admin API, so open the dashboard through the API Service.

When `cp-api` uses a NodePort, set `api.publicBaseURL` to the externally reachable origin at that port or the origin of the TLS reverse proxy in front of it. If gateways run outside the cluster, provide a TCP path to the `dp-manager` Service that preserves its mTLS connection, then set `api.dpmgrBaseURL` to the externally reachable HTTPS endpoint. The `dp-manager` health listener on port `7946` remains pod-internal and is not part of this Service.

For AISIX Enterprise control-plane configuration variables and Helm values, see [AISIX Enterprise Configuration Reference](https://docs.api7.ai/ai-gateway/reference/on-premises-configuration.md).
