Static IP guide

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

For Python on Heroku, one environment variable is often the entire integration: requests honors http_proxy and https_proxy, so exporting both with the FIXIE_URL value routes every outbound call through your static IPs without touching application code. The proxies-dict form shown below scopes it to specific requests instead.

RuntimePython
PlatformHeroku
DestinationAPI allowlisting
Fixie productFixie HTTP/S Heroku add-on

Recommended setup

Use Fixie HTTP/S Heroku add-on 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 Heroku

Heroku is a native Fixie marketplace flow. Install the Fixie HTTP/S Heroku add-on or attach it from the Heroku CLI. Heroku will create FIXIE_URL as a config var for the app.

Attach fixie to your Heroku app

heroku addons:create fixie
heroku config:get FIXIE_URL

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

  • To proxy everything, set http_proxy and https_proxy config vars to the same value as FIXIE_URL — urllib and most libraries built on it comply automatically.
  • Scope matters: the proxies= argument affects one call; the environment variables affect the whole process, including SDKs that make HTTP calls internally.

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 Heroku.
  4. Run a small connection test before sending production traffic.

Related guides

Related docs