Network restrictions
Direct database connections go through the connection pooler (PgBouncer). Two per-project settings control who may connect:
- Enforce SSL: connections that do not use TLS are rejected.
- Allowed IP addresses: a list of IPv4 / IPv6 addresses or CIDR ranges. When the list is empty, any address may connect. When it has entries, every other address is rejected.
Both apply only to clients outside the Base network. The Data API, Auth, Storage, Realtime and every other Base service reach the database over the internal network and are never restricted, so a wrong list cannot take your project offline. You can always still reach the database from the SQL editor.
In the dashboard
Section titled “In the dashboard”Open Database → Settings (owners only), turn on Enforce SSL and/or list the allowed addresses, one per line, then Save settings. The pooler applies the change within a few seconds. Existing connections stay open until they close; only new connections are checked.
With the Management API
Section titled “With the Management API”curl -X PATCH "$BASE_URL/v1/projects/my-project/config/db" \ -H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \ -d '{"ssl_enforced": true, "allowed_cidrs": ["203.0.113.0/24", "2001:db8::/32"]}'- A bare address becomes
/32(IPv4) or/128(IPv6). Entries are normalised and de-duplicated. - At most 50 entries. An invalid entry returns
400 validation_failedand nothing is saved. GET /v1/projects/{ref}/config/dbreturnsssl_enforced,allowed_cidrsandenforcement_available.
Connecting with TLS
Section titled “Connecting with TLS”Use sslmode=require (or verify-full with the CA of your certificate):
postgres://USER:PASSWORD@db.example.com:5432/PROJECT_DB?sslmode=requireHosted Base projects already have a certificate. On a self-hosted instance see Self-hosting: without a certificate configured, Enforce SSL makes the database unreachable from outside the Base network.