Ployter

Private access and public ports

How to protect a domain with an IP filter and a password, open a TCP port to connect from outside and link services from different projects over the private network.

By default, a service can only be reached in two ways: through its domains (HTTP and HTTPS) and through the project's internal network, by other services in the same project on the same server. The Network tab has three cards to change that:

Card What it's for
Access through domains Restrict an internal panel to a few IPs or ask for a username and password in the browser.
Public access (TCP) Connect from outside to a database, Redis or another non-HTTP service, for example with DBeaver.
Private access Let other team projects and machines on the private network connect, without exposing the service to the internet.

All three need the service's Port set in Settings, and none of them applies to services with replicas: their traffic comes in through the load balancer.

Access through domains

Use it for internal panels (database manager, admin, tools). Before the request reaches the service, the server checks the visitor's IP and/or asks for a username and password.

  1. Open the service and go to the Network tab.
  2. In the Access through domains card, under Who can open it, choose Allowed IPs only and add the IPs (the My IP button fills in yours). It accepts an IP (203.0.113.4) or a network (203.0.113.0/24).
  3. To require a password, turn on Ask for username and password. The panel generates the username and password, which show in the card after you save.
  4. Click Save.
  5. Run a deploy. It applies from the next deploy.

Access through domains card with one allowed IP and the password turned on
Access through domains card with one allowed IP and the password turned on

To change the password, click Generate new password, save and run a deploy.

Warning

With Cloudflare in proxy mode (orange cloud), the server sees Cloudflare's IP, not the visitor's, and the IP filter blocks everyone. In that case, use only the password.

The database manager installed with the project's Database manager button already uses this card when the tool has no login of its own. See Databases as a service.

Public access (TCP)

Opens a server port to the internet, linked to the service's port. Use it to connect from your computer to a database in a container, a Redis or another non-HTTP service.

  1. Open the service (e.g. mysql) and go to the Network tab.
  2. In the Public access (TCP) card, turn on the switch.
  3. Under Public port, choose the port on the server (1024 or higher). The default is the same port as the service.
  4. Under Who can connect, keep Allowed IPs only and add your IP with My IP. The Server or service button adds the public IP of a server or service in the panel.
  5. Click Save.
  6. Run a deploy.

The card shows the Address to connect, for example 203.0.113.10:3306. Use it with the database's username and password.

Public access (TCP) card on the mysql service with one allowed IP
Public access (TCP) card on the mysql service with one allowed IP

How it works:

  • On an AWS or DigitalOcean server, the panel updates the cloud firewall right away, opening the port only to the IPs in the list.
  • The port is published on the server on the next deploy.
  • With a public port, the deploy stops the current version before starting the new one: a few seconds of downtime.
Warning

With Any IP, the port is open to the whole internet and only the service's password protects it. Use a strong password and prefer allowing specific IPs.

Note

On your own server, the panel doesn't control the firewall: the port is open to any IP. Restrict it in your provider's firewall. See Use your own server.

To close it, turn off the switch. The service goes back to internal network only.

Private access

Publishes the service's port only on the server's private IP. The internet can't reach it. Use it when:

  • A database in one project serves sites from other projects on the same server.
  • Machines on the cloud's private network (another of your servers in the same VPC) need to connect.
  1. Open the service and go to the Network tab.
  2. In the Private access card, turn on the switch.
  3. If you want, change the Private port (1024 or higher) and confirm. If you don't choose one, the panel uses a free port starting at 21000.
  4. Run a deploy. The port is published on the next deploy.

Private access card on the mysql service with the address and ready-to-use connections
Private access card on the mysql service with the address and ready-to-use connections

The card shows:

  • Address: the server's private IP and the port, e.g. 10.0.1.15:21000.
  • Variables: PRIVATE_HOST and PRIVATE_PORT, to copy.
  • Ready-to-use connections: the service's connection variables (the ones ending in _URL) already with the private address. Paste them into the other project, for example as DATABASE_URL. They contain the password, so they only show for people who can see variable values.
Tip

For a database serving several sites, create one user per site in the service's Database tab, instead of using root.

Details:

  • On AWS and DigitalOcean, the cloud firewall opens the port only to the private network (e.g. 10.0.0.0/16).
  • If the server has no private IP, only containers on the same machine can reach the address.
  • With a port on the machine, the deploy stops the current version before starting the new one: a few seconds of downtime.

See how the private network between servers works in Private network and firewall.

Permissions

All three cards require the Manage domains permission. See Teams, members and roles.