Static IP for Railway
Share one fixed outbound IPv4 across multiple Railway services, CI runners, and your local machine — on any Railway plan.
First payment refunded within 7 days if it doesn’t work for you
- Partner API
- External DB
On this page13
Railway services exit from shared rotating addresses by default, while Railway’s native static IPs require the Pro tier and stay locked to the platform. Prontaro routes selected traffic through an HTTP/SOCKS5 proxy, a Relay URL, or prontaro forward, depending on whether you are calling REST APIs or connecting to an external database.
Which method to choose
| Destination | Prontaro method | Best for |
|---|---|---|
| Partner REST/GraphQL APIs | HTTPS proxy (PRONTARO_PROXY_URL) |
End-to-end TLS and mTLS via HTTP CONNECT; works in Node.js, Python, Go, PHP, Ruby |
| Single-host REST API without proxy code | Relay URL (PRONTARO_RELAY_URL) |
Swap the base URL in built-in fetch; no proxy dependencies |
| External databases (MongoDB Atlas, Postgres, MySQL) | SOCKS5 (socks5h://) or prontaro forward |
Forwards database TCP connections from your dedicated IP |
A Relay URL decrypts TLS on the Prontaro server and opens a new HTTPS connection to the target API. Use HTTPS proxy when a partner requires end-to-end TLS or mTLS — see Relay URLs.
Prerequisites
- A Prontaro account on Dedicated or Pro (plans). Open my.prontaro.com/ips, pick a location near your Railway region, and click Add IP.
- A Railway project and service.
- You do not need
prontaro CLIfor HTTP proxy, SOCKS5, or Relay URLs — create credentials directly in the dashboard. The CLI is only needed inside your container forprontaro forward.
Step 1. Create credentials and allowlist your IP
Add your dedicated IPv4 (/32) to the partner API or database allowlist, then create dedicated credentials for your Railway service in the dashboard.
- Open IP addresses in my.prontaro.com, select your IP, and click Create proxy credentials (for example,
railway-api). - Copy the
HTTPSURL (https://u_rail:s3cr3t@<entry>.prontaro.io:443), orSOCKS5(socks5h://...) for external databases. - If you prefer a Relay URL for a single REST API, click Add relay address and enter
api.example.com.
Leave the To destination list unrestricted until Step 5 so the api.ipify.org check in Step 4 works.
Step 2. Add environment variables in Railway
Open your service in Railway and go to Service → Variables. If multiple services share settings, use Project → Shared Variables or paste them in Raw Editor.
- PRONTARO_PROXY_URL
- https://u_rail:s3cr3t@<entry>.prontaro.io:443
- NO_PROXY
- localhost,127.0.0.1,.railway.internal
Click Apply Changes / Deploy so Railway redeploys the service with the new variables. If multiple services share one IP, create separate proxy credentials per service (railway-worker) so each can be scoped and revoked independently.
Step 3. Route requests through your static IP
HTTPS API calls (Node.js with undici)
Install undici (npm install undici), create ProxyAgent once at process startup, and reuse it for every request:
// 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 getPartnerStatus() {
const response = await fetch('https://api.example.com/v1/status', {
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();
}The same proxy URL works in Python, Go, PHP, and Ruby — see HTTP & SOCKS5 proxy.
REST API via Relay URL
Store PRONTARO_RELAY_URL in Railway Variables and call built-in fetch with no proxy library:
const response = await fetch(new URL('/v1/status', process.env.PRONTARO_RELAY_URL), {
headers: { Authorization: `Bearer ${process.env.PARTNER_API_TOKEN}` },
signal: AbortSignal.timeout(15_000),
});External databases: SOCKS5 and prontaro forward
- Driver with native SOCKS5: store the
socks5h://URL inPRONTARO_SOCKS_URLand pass it to the driver. See the MongoDB Atlas guide for a complete example. - Drivers without SOCKS5: create a CLI token (CLI → New token), save it in Railway Variables as
PRONTARO_KEY(CLI reads it withoutprontaro login), and startprontaro forwardbefore your app:
#!/bin/sh
# start.sh — container entrypoint (with prontaro installed in your Dockerfile)
set -e
prontaro forward 15432 db.example.com:5432 --ip 203.0.113.10 --no-input &
FWD_PID=$!
# Wait for the local port before starting the app
for i 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 node server.mjsYour app connects to 127.0.0.1:15432, and outbound traffic leaves from your dedicated Prontaro 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 Railway restarts the service according to its Restart Policy in Service → Settings (On Failure by default, up to 10 retries, or Always on paid plans). Once running, prontaro forward waits and recovers on its own.
Step 4. Verify the outbound IP from Railway
Do not use railway run curl ... for network verification: railway run pulls variables and runs curl locally on your laptop, not inside your Railway container.
Verify directly inside the deployed container with railway ssh:
railway ssh -- curl -fsS --proxy "$PRONTARO_PROXY_URL" https://api.ipify.org
203.0.113.10If your container image does not include curl, add a temporary /egress-check route in your app that calls https://api.ipify.org through your agent, hit it after deploy, and remove it once verified.
Step 5. Lock down allowed targets (recommended)
Once verified, restrict your credentials to the required host and port:
- Open IP addresses → Proxy credentials in my.prontaro.com, select
railway-api, and switch to Access. - Add
api.example.com:443(or*.mongodb.net:27017for Atlas) under To and save.
Railway notes and limits
- Align regions. Choose the Prontaro location in the dashboard closest to your Railway service region to minimize latency.
- One IP across services. Multiple Railway services can share one dedicated IPv4 as long as total open connections stay within your plan limit.
Common errors
| Error | Cause | Fix |
|---|---|---|
Internal Railway Postgres or Redis unreachable after setting HTTPS_PROXY |
Global proxy intercepted *.railway.internal. |
Add .railway.internal to NO_PROXY, or pass PRONTARO_PROXY_URL only to the external HTTP client. |
| Variables saved, but the app still sees old values | No fresh deployment ran after updating Variables. | Click Apply Changes / Deploy on the Railway service. |
ECONNREFUSED 127.0.0.1:15432 with prontaro forward |
App started before the local port finished binding. | Wait for nc -z 127.0.0.1 15432 in start.sh before exec. |
For 407, 403, or PRONTARO_KEY token errors, see error codes and HTTP & SOCKS5 proxy.
Next steps
- Connect to MongoDB Atlas — reach MongoDB Atlas from a dedicated IPv4 over SOCKS5.
- Local port forwarding (
prontaro forward) — forward TCP connections for database drivers without SOCKS5 support. - HTTP & SOCKS5 proxy — language examples and allowed destination rules.
- Static IP for Render — the same pattern for Render Web Services, Workers, and Cron Jobs.
- Reliability, zero-downtime updates, and BGP failover — how your
/32stays intact during server failover.
Related guides
- Node.js and TypeScriptConfigure a Prontaro dedicated static IPv4 in Node.js and TypeScript with undici, axios, native fetch, SOCKS5, or Relay URLs.
- Connect to MongoDB AtlasReplace 0.0.0.0/0 in MongoDB Atlas Network Access with one dedicated Prontaro IPv4 and connect via SOCKS5 or prontaro forward.
- Local port forwarding (prontaro forward)Connect database drivers, SFTP clients, and CLI tools to remote servers from your static IPv4 over a local TCP port — no proxy support needed.
- HTTP & SOCKS5 proxyRoute outbound HTTP, HTTPS, and TCP connections through your static IPv4 with one proxy credential set, end-to-end TLS, and From/To rules.
Something wrong on this page? Contact us