Static IP guide

Making API requests with a static IP from a Python app on Railway

A Python service on Railway reaches allowlisted APIs through the same proxies-dict pattern as anywhere else: read FIXIE_URL from the service's Variables tab and pass it to requests, or export http_proxy and https_proxy for a process-wide proxy with no code changes. Railway's shared NAT means the service's own outbound IP can change; Fixie's proxy gives it a fixed pair instead.

RuntimePython
PlatformRailway
DestinationAPI allowlisting
Fixie productFixie HTTP/S proxy

Recommended setup

Use Fixie HTTP/S proxy for HTTP and HTTPS requests to an API, webhook provider, or service that allowlists outbound IP addresses. Store the proxy value in FIXIE_URL, then configure Python to route outbound traffic through Fixie before connecting to API allowlisting.

Set up Fixie on Railway

Create a Fixie HTTP/S proxy in the Fixie dashboard. Copy the proxy value into Railway Variables as FIXIE_URL, 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.

Make an HTTP request through FIXIE_URL

import os
import requests

proxies = {
    "http": os.environ["FIXIE_URL"],
    "https": os.environ["FIXIE_URL"],
}

response = requests.get("https://api.example.com/data", proxies=proxies)
print(response.status_code)

Good to know

  • Railpack builds Python services automatically from a requirements.txt or pyproject.toml, so no Dockerfile changes are needed to add the proxy, just the environment variable.
  • Reference Variables let a worker service in the same project reuse the web service's FIXIE_URL without duplicating the value.

Allowlist and test the static IPs

  1. Open the Fixie dashboard and copy the outbound IP addresses for this proxy.
  2. Add both IPs to the API provider.
  3. Deploy the updated Python app on Railway.
  4. Run a small connection test before sending production traffic.

Related guides

Related docs

Is this guide useful?