Static IP guide

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

Heroku cycles dynos at least once a day, and every restart can land your app on a new outbound IP — which breaks integrations with payment processors, banking APIs, and any partner that allowlists callers by address. The Fixie HTTP/S add-on gives your Node app two IPs that never change, exposed through the FIXIE_URL config var that axios can use directly.

RuntimeNode.js and JavaScript
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 Node.js 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

const axios = require('axios');

const fixieUrl = new URL(process.env.FIXIE_URL);

axios.get('https://api.example.com/data', {
  proxy: {
    protocol: 'http',
    host: fixieUrl.hostname,
    // URL drops default ports, so fall back to 80 for Fixie's standard proxy port.
    port: Number(fixieUrl.port) || 80,
    auth: {
      username: fixieUrl.username,
      password: fixieUrl.password,
    },
  },
}).then((response) => {
  console.log(response.status);
});

Good to know

  • Attaching the add-on sets FIXIE_URL and restarts your dynos automatically, so no code deploy is needed to pick up the variable.
  • HTTPS requests tunnel through the proxy with the CONNECT method, so TLS stays end-to-end and Fixie never sees request contents.
  • If you use fetch instead of axios, wrap FIXIE_URL in an https-proxy-agent as shown in the JavaScript docs — Node's built-in fetch ignores proxy environment variables.

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

Related guides

Related docs