Static IP guide
Connecting to an SFTP server with a static IP from a Node app on Heroku
Plenty of partner integrations still end in a nightly file drop to an SFTP server that only accepts known IPs. Rather than teaching an SFTP client about SOCKS, run Fixie-Wrench in your dyno: it forwards a local port through Fixie Socks, and your Node code (ssh2, ssh2-sftp-client) connects to localhost as if the server were local.
Recommended setup
Use Fixie Socks Heroku add-on for SFTP transfers or SSH-based file workflows that require a fixed source IP. Store the proxy value in FIXIE_SOCKS_HOST, then configure Node.js to route outbound traffic through Fixie before connecting to SFTP.
Set up Fixie on Heroku
Heroku is a native Fixie marketplace flow. Install the Fixie Socks Heroku add-on or attach it from the Heroku CLI. Heroku will create FIXIE_SOCKS_HOST as a config var for the app.
Attach fixie-socks to your Heroku app
Implementation
The example below shows the core application-side change. Keep credentials in environment variables and avoid committing proxy, database, or API secrets.
Forward a local port to SFTP through Fixie Socks
Good to know
- Start the tunnel in your Procfile ahead of the app, e.g.
worker: ./bin/fixie-wrench 2222:sftp.example.com:22 & node upload.js. - Point your SFTP client at host
127.0.0.1, port2222— the tunnel delivers the connection to the real server's port22from a Fixie IP. - SSH host-key verification still works through the tunnel, but the client records the key under localhost; pin the server's key explicitly if your library supports it.
Allowlist and test the static IPs
- Open the Fixie dashboard and copy the outbound IP addresses for this proxy.
- Add both IPs to the SFTP server firewall.
- Deploy the updated Node.js app on Heroku.
- Run a small connection test before sending production traffic.
Related guides
- Making API requests with a static IP from a Node app on Heroku
- Connecting to an SFTP server with a static IP from a Ruby app on Heroku
- Connecting to Postgres with a static IP from a Node app on Heroku
- Connecting to MySQL with a static IP from a Node app on Heroku
- Connecting to MongoDB with a static IP from a Node app on Heroku
- Connecting to Amazon Redshift with a static IP from a Node app on Heroku
Related docs
- Node.js implementation examples
- Heroku setup documentation
- SFTP connection guide
- Fixie-Wrench for TCP forwarding
Is this guide useful?