CTRLctrl docs

Ports and TCP

Your app's main port is the one it was deployed with. It serves HTTP at the app's getctrl.dev address. You can add more ports, up to 10 per app in all, counting the main one.

Each port speaks one of two protocols:

  • HTTP: CTRL serves it over HTTPS at a hostname and handles the certificate.
  • TCP: raw TCP, for databases, game servers and anything else that isn't HTTP. CTRL passes the bytes through as they are and adds no TLS. If your service needs encryption, it does its own.

Add a port#

Open the app in the dashboard, find ctrl ports, enter the port your app listens on, choose http or tcp and select + add port. Through the API:

curl -X POST https://api.getctrl.dev/v1/apps/my-app/ports \
  -H "Authorization: Bearer $CTRL_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"port": 5432, "protocol": "tcp"}'

The port must be a whole number from 1 to 65535, and not one the app already has. To see an app's ports, GET /v1/apps/my-app/ports. The main port comes first.

Reach an HTTP port#

A new HTTP port has no hostname yet. Each hostname points at exactly one port, and you have two ways to give a port one:

  • A generated subdomain. Select generate hostname. The port is served at <app>-<port>.getctrl.dev, for example shop-3000.getctrl.dev. Through the API, send PATCH /v1/apps/my-app/ports/3000 with {"subdomain": true}, or false to drop it.
  • A custom domain. Add the domain the same way as any custom domain: verify it with a TXT record, then point a CNAME at CTRL. Once the app has more than one HTTP port, the domain form asks which port the domain serves. Through the API, add "port": 3000 to the request. Leaving port out means the main port.

Internal domains, which would let one app reach another privately, are not available yet.

Reach a TCP port#

CTRL gives a TCP port a public port from the range 20000–29999. The lowest free number is picked for you, and you can't choose it. Your app keeps the public port as long as it keeps the TCP port, including while it is stopped.

Clients connect to <app>.tcp.getctrl.dev on that public port, for example:

psql "host=shop.tcp.getctrl.dev port=20000 user=app dbname=app"

The dashboard shows the address with a copy button. A TCP port takes no hostname or custom domain.

Raw TCP doesn't go through Cloudflare. It reaches CTRL's proxies on their public IP addresses, where the only DDoS protection is OVH's.

When CTRL updates its proxies, open TCP connections get up to 10 seconds to finish, and are then closed. Make sure your clients reconnect.

Remove a port#

Select remove next to the port, or send DELETE /v1/apps/my-app/ports/5432. A few rules:

  • You can't remove the main port.
  • You can't remove a port that a custom domain still points at. Remove the domain first.
  • A removed TCP port gives up its public port, which may then go to another app.