All your organisation’s apps share a private network. On it, they reach each other by name, on any port, without going through the internet.
The names
| Name | Reaches |
|---|---|
<app>.internal |
Every instance of the app, whatever its process |
<process>.<app>.internal |
Every instance of one process of the app |
So a database app called db, with no web process, is db.internal, and the worker process of an app called shop is worker.shop.internal.
The app’s Overview shows its private address under Private address, for your other apps.
Connecting to another app
Use the name in your connection settings, with the port the other app listens on:
DATABASE_URL=postgres://app:secret@db.internal:5432/app
REDIS_URL=redis://cache.internal:6379
Put values like these in secrets.
- Any port, TCP or UDP, is open between your own apps.
- Listen on all interfaces: the app you connect to must listen on
0.0.0.0or::, not only on127.0.0.1. - IPv4: the names resolve to IPv4 addresses.
- Release commands and console sessions are on the network too, so a migration can reach
db.internal.
Each instance’s own private address is in the variable whose name ends in _PRIVATE_IP.
Only your organisation
- Only your organisation’s apps can reach your apps on the private network, by name or by address.
- Another organisation’s app names don’t resolve for you, and yours don’t for them. A name you can’t reach looks exactly like one that doesn’t exist.
- Nothing on the private network is reachable from the internet. Only your web process is public, through its web address.
Sleeping apps
A sleeping web process keeps its private addresses.
- A new connection to it is held while it wakes, then reaches it, as if it had been slow to answer.
- If it doesn’t become healthy in time, the connection is refused, so your app fails quickly instead of hanging. Retry it.
- Traffic from your other apps keeps a web process awake, as visitors do. A connection left open with nothing on it doesn’t.
See Processes for sleep when idle.
What it costs
Nothing. Traffic between your own apps on the private network isn’t billed, and doesn’t count as data out.
Calling another of your apps on its public address goes out through the internet and back, and does count. Use its private address instead. See Networking.