Static IP guide
Connecting to Postgres with a static IP from a Node app on Render
A Node service on Render talking to an external allowlisted Postgres database can go fully in-code: socksjs opens the connection through Fixie Socks and pg rides on top as a custom stream. Unlike serverless platforms, Render services are long-running, so a Fixie-Wrench sidecar is an equally valid choice if you prefer zero driver changes.
Recommended setup
Use Fixie Socks proxy for Postgres connections to a database that only accepts traffic from approved IP addresses. Store the proxy value in FIXIE_SOCKS_HOST, then configure Node.js to route outbound traffic through Fixie before connecting to Postgres.
Set up Fixie on Render
Create a Fixie Socks proxy in the Fixie dashboard. Copy the proxy value into Render Environment Variables as FIXIE_SOCKS_HOST, and copy the outbound IPs into the destination allowlist.
Implementation
The example below shows the core application-side change. Keep credentials in environment variables and avoid committing proxy, database, or API secrets.
Connect to Postgres through FIXIE_SOCKS_HOST
Good to know
- If you hold connections open, send a periodic keepalive query to keep an idle tunnel connection from being recycled.
- The sidecar variant works in the same container: prepend
./bin/fixie-wrench 5432:postgres.example.com:5432 &to your start command.
Allowlist and test the static IPs
- Open the Fixie dashboard and copy the outbound IP addresses for this proxy.
- Add both IPs to the Postgres firewall or security group.
- Deploy the updated Node.js app on Render.
- Run a small connection test before sending production traffic.
Related guides
- Making API requests with a static IP from a Node app on Render
- Connecting to Postgres with a static IP from a Node app on Heroku
- Connecting to Postgres with a static IP from a Python app on Render
- Connecting to MongoDB with a static IP from a Node app on Render
- Connecting to Postgres with a static IP from a Node app on Vercel
- Connecting to Postgres with a static IP from a Node app on Fly.io
Related docs
- Node.js implementation examples
- Render setup documentation
- Postgres connection guide
- Fixie-Wrench for TCP forwarding
Is this guide useful?