Static IP guide
Making API requests with a static IP from a Go app on Fly.io
Fly.io and Go pair naturally, and so do Go and proxies: http.ProxyURL(fixieURL) on a Transport is the whole integration. With FIXIE_URL stored as a Fly secret, every machine in every region makes API calls from the same two static addresses.
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 Go to route outbound traffic through Fixie before connecting to API allowlisting.
Set up Fixie on Fly.io
Create a Fixie HTTP/S proxy in the Fixie dashboard. Copy the proxy value into Fly.io secrets as FIXIE_URL, and copy the outbound IPs into the destination allowlist.
Set a Fly.io secret
fly secrets set 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
package main
import (
"net/http"
"net/url"
"os"
)
func main() {
fixieURL, err := url.Parse(os.Getenv("FIXIE_URL"))
if err != nil {
panic(err)
}
client := &http.Client{
Transport: &http.Transport{Proxy: http.ProxyURL(fixieURL)},
}
_, err = client.Get("https://api.example.com/data")
if err != nil {
panic(err)
}
}Good to know
- The default transport honors HTTPS_PROXY, so setting that secret to the Fixie URL also proxies third-party SDKs that construct clients from defaults.
- Fly regions span the globe — pick the Fixie region closest to where your machines actually run, not where you deploy from.
Allowlist and test the static IPs
- Open the Fixie dashboard and copy the outbound IP addresses for this proxy.
- Add both IPs to the API provider.
- Deploy the updated Go app on Fly.io.
- Run a small connection test before sending production traffic.
Related guides
- Making API requests with a static IP from a Go app on Heroku
- Making API requests with a static IP from a Node app on Fly.io
- Making API requests with a static IP from a Go app on Vercel
- Making API requests with a static IP from a Python app on Fly.io
- Making API requests with a static IP from a Go app on Render
- Making API requests with a static IP from a Go app on AWS Lambda