# Static IP for Render

Source: https://prontaro.com/docs/integrations/render/

When an API or database requires a single dedicated /32 instead of Render's shared pool, route those calls through Prontaro.

Render’s built-in static outbound IPs are shared across customers in the same region and stay tied to the platform. A Prontaro IPv4 belongs exclusively to your account and works across Web Services, Background Workers, Cron Jobs, CI pipelines, and local debugging. It lets you route only selected calls through your static IP while all other traffic continues directly.

## Which method to choose

| Render workload | Prontaro method | Best for |
| --- | --- | --- |
| **Partner REST/GraphQL APIs** | HTTPS proxy (`PRONTARO_PROXY_URL`) | End-to-end TLS and mTLS over HTTP CONNECT; works in Node.js, Python, and Go |
| **Single-host REST API without proxy libraries** | [Relay URL](https://prontaro.com/docs/outbound/relay.md) (`PRONTARO_RELAY_URL`) | Swap only the base URL in built-in `fetch` |
| **Allowlisted databases (Postgres, MongoDB)** | `socks5h://` or `prontaro forward` | Forwards database TCP connections from your static IPv4 |

> **TLS behavior with Relay URLs**
>
> Relay decrypts TLS on the Prontaro server and opens a new HTTPS connection to the target API. If a partner requires end-to-end TLS or mTLS, use the HTTPS proxy (`PRONTARO_PROXY_URL`).

## Prerequisites

- A Prontaro account on Dedicated (starting at $12/month, 100 GB traffic included) or Pro ([plans and pricing](https://prontaro.com/docs/billing/plans.md)).
- A dedicated IPv4 in the Prontaro location closest to your Render service region (available locations are shown in the dashboard).
- A Render Web Service, Background Worker, or Cron Job.

## Step 1. Create proxy credentials and allowlist your IP

Add your dedicated Prontaro IPv4 (`/32`) to the partner API or database allowlist, then create dedicated proxy credentials for Render in the dashboard. Leave the **To** destination list open until you verify the outbound IP.

1. Open **IP addresses** in [my.prontaro.com](https://my.prontaro.com/ips) and click **Create proxy credentials**.
2. Name them `render-prod`, keep destination rules open for the initial check, and copy the `HTTPS` URL (port `:443`).

IP addresses Proxy credentials [Open in dashboard](https://my.prontaro.com/ips)

## Step 2. Add the environment variable in Render

Add `PRONTARO_PROXY_URL` to your Render service settings. If a Web Service, Worker, and Cron Job share one static IP, either attach an Environment Group or create separate proxy credentials per service so you can restrict or revoke each one independently.

**Service → Environment → Environment Variables**

- `PRONTARO_PROXY_URL`: `https://u_render:s3cr3t@<entry>.prontaro.io:443`

Render automatically triggers a redeploy after you save the variable.

> **Avoid setting a global HTTPS_PROXY**
>
> Setting a process-wide `HTTPS_PROXY` instead of passing `PRONTARO_PROXY_URL` explicitly can hijack calls to Render Private Services, internal Render Postgres, or Key Value and fail on the proxy. Pass `PRONTARO_PROXY_URL` only to the HTTP client calling allowlisted external APIs.

## Step 3. Route requests through your static IP

### Node.js (Web Services and Cron Jobs with `undici`)

Install `undici` (`npm install undici`) and instantiate `ProxyAgent` once at module scope so connections are reused:

```js
// src/partnerClient.mjs
import { fetch, ProxyAgent } from 'undici';

const proxyUrl = process.env.PRONTARO_PROXY_URL;
if (!proxyUrl) {
  throw new Error('PRONTARO_PROXY_URL is not set');
}

const agent = new ProxyAgent({
  uri: proxyUrl,
  connections: 20,
});

export async function callPartner(path = '/v1/status') {
  const response = await fetch(`https://api.example.com${path}`, {
    dispatcher: agent,
    headers: {
      Authorization: `Bearer ${process.env.PARTNER_API_TOKEN}`,
    },
    signal: AbortSignal.timeout(15_000),
  });

  if (!response.ok) {
    throw new Error(`Partner API returned ${response.status}`);
  }
  return response.json();
}
```

### Python (`httpx`)

Install `httpx` (`pip install httpx`) and reuse a single `httpx.Client` (or `AsyncClient` for FastAPI):

```python
# partner_client.py
import os
import httpx

client = httpx.Client(
    proxy=os.environ["PRONTARO_PROXY_URL"],
    timeout=httpx.Timeout(15.0, connect=5.0),
    limits=httpx.Limits(max_connections=20, max_keepalive_connections=10),
)

def call_partner(path: str = "/v1/status") -> dict:
    resp = client.get(
        f"https://api.example.com{path}",
        headers={"Authorization": f"Bearer {os.environ['PARTNER_API_TOKEN']}"},
    )
    resp.raise_for_status()
    return resp.json()
```

### Go (`net/http`)

Parse `PRONTARO_PROXY_URL` once at startup and pass it to `http.Transport`:

```go
package partner

import (
	"fmt"
	"net/http"
	"net/url"
	"os"
	"time"
)

func NewHTTPClient() (*http.Client, error) {
	raw := os.Getenv("PRONTARO_PROXY_URL")
	if raw == "" {
		return nil, fmt.Errorf("PRONTARO_PROXY_URL is not set")
	}
	proxyURL, err := url.Parse(raw)
	if err != nil {
		return nil, err
	}
	return &http.Client{
		Timeout: 15 * time.Second,
		Transport: &http.Transport{
			Proxy:               http.ProxyURL(proxyURL),
			MaxIdleConns:        50,
			MaxIdleConnsPerHost: 20,
			IdleConnTimeout:     90 * time.Second,
		},
	}, nil
}
```

### Connecting to allowlisted databases (`socks5h://` and `prontaro forward`)

When a Render service or Cron Job connects to an external database behind an IP allowlist (AWS RDS, MongoDB Atlas, self-hosted PostgreSQL):

- **Native SOCKS5 drivers** (Node.js `mongodb` + `socks`, `pg` + `socks`): store `socks5h://u_render:s3cr3t@<entry>.prontaro.io:1080` in `PRONTARO_SOCKS_URL`.
- **Why `socks5h://` (with `h`):** DNS resolves on the Prontaro server so domain-based **To** rules work.
- **Drivers without SOCKS5** (`psql`, Prisma, SQLAlchemy, Go `pgx`): install `prontaro CLI` in your Docker image and set `PRONTARO_KEY` in Render (create a token under **CLI** in [my.prontaro.com](https://my.prontaro.com/)).

Launch `prontaro forward` in your entrypoint before starting the app:

```sh
#!/bin/sh
set -eu
prontaro forward 15432 db.example.com:5432 --ip 203.0.113.10 --json --no-input &
FWD_PID=$!
for _ in $(seq 1 30); do
  nc -z 127.0.0.1 15432 && break
  kill -0 "$FWD_PID" 2>/dev/null || break
  sleep 0.5
done
nc -z 127.0.0.1 15432 || exit 1
exec "$@"
```

Your app connects to `127.0.0.1:15432`, and the remote database sees your dedicated static IPv4. With `--no-input`, startup refusals (such as an unpaid or blocked account) exit immediately with a non-zero code instead of waiting; the entrypoint exits `1`, and Render automatically restarts Background Workers and Web Services on non-zero exit until the service comes up. Once running, `prontaro forward` waits and recovers on its own. See [PostgreSQL and AWS RDS](https://prontaro.com/docs/integrations/postgres.md) for full TLS and driver details.

## Step 4. Verify the outbound IP

Open your service’s **Shell** in the Render dashboard (or run a one-off check in your Cron Job) and query `api.ipify.org` before tightening allowed destinations:

```
 curl -fsS --proxy "$PRONTARO_PROXY_URL"
203.0.113.10
```

Confirm the address matches your dedicated IPv4 in [my.prontaro.com](https://my.prontaro.com/).

## Step 5. Lock down allowed destinations

Once verification succeeds, restrict `render-prod` to the exact partner hosts and ports so a leaked secret cannot reach unrelated destinations.

1. Open **IP addresses → Proxy credentials** in [my.prontaro.com](https://my.prontaro.com/ips), select `render-prod`, and switch to **Access**.
2. Add the target host and port (for example, `api.example.com:443`) under **To** and save.

IP addresses Proxy credentials Access [Open in dashboard](https://my.prontaro.com/ips)

## Render notes and limits

- **Pair nearby regions:** choose the Prontaro location in the dashboard closest to your Render service region to minimize latency.
- **Cron Jobs and clean shutdown:** set explicit HTTP timeouts (`10–15s`) and terminate background `prontaro forward` via a shell `trap`, otherwise a Cron Job container can hang waiting for background stdout/stderr to close.
- **One IP across multiple services:** a single dedicated IPv4 can serve Web Services, Workers, and Cron Jobs together within your plan’s concurrent connection limit ([limits](https://prontaro.com/docs/billing/limits.md)).
- **[BGP failover](https://prontaro.com/docs/outbound/failover.md):** on a server outage or reboot, Prontaro moves your `/32` to a standby Prontaro server with the same allowlisted IP. Active TCP sessions close; new requests and retries resume from the same address.

## Common errors

| Symptom | Cause | Fix |
| --- | --- | --- |
| `407 Proxy Authentication Required` | Typo in `PRONTARO_PROXY_URL`, or newly created credentials are still propagating (a few seconds). | Copy the exact URL under [IP addresses](https://my.prontaro.com/ips), save in Render, and wait for the redeploy. |
| `403 Forbidden` from proxy | Destination host or port is missing from the **To** list. | Add `<host>:443` (or `:5432` for databases) under **To** in the credentials’ **Access** tab. |
| Internal Render Postgres or Redis stopped responding | A global `HTTPS_PROXY` intercepted internal service traffic. | Remove global `HTTPS_PROXY` and pass `PRONTARO_PROXY_URL` only to the external HTTP client. |
| `ECONNREFUSED 127.0.0.1:15432` | App started before `prontaro forward` opened the local socket. | Wait for `127.0.0.1:15432` in your container entrypoint before starting the app. |

## Next steps

- [PostgreSQL and AWS RDS with a static IP](https://prontaro.com/docs/integrations/postgres.md) — TLS and driver setup for allowlisted PostgreSQL instances.
- [Language guides](https://prontaro.com/docs/languages/) — proxy examples for Node.js, Python, Go, PHP, and Java.
- [HTTP & SOCKS5 proxy](https://prontaro.com/docs/outbound/proxy.md) — proxy credentials, protocols, and allowed destination rules.
- [Static IP for Railway](https://prontaro.com/docs/integrations/railway.md) — dedicated IPv4 setup for Railway services.
- [Local port forwarding (`prontaro forward`)](https://prontaro.com/docs/outbound/forward.md) — TCP forwarding for database drivers without SOCKS5 support.
