Static IP on Heroku - How to get one
Approximate time to read: 2 min
It’s easy to get a static IP on Heroku. Here’s how.
Why would you need a static IP address for your Heroku app?
You may need to add a firewall rule to your systems so you can access a protected internal database or API. Maybe you want to access a third party’s API and they only accept traffic from specified IPs.
The good news is that you can get the benefits of Heroku’s horizontal scalability and all the other goodness it offers whilst still routing your critical traffic through a static IP.
I’m going to be talking about outbound traffic only here. If you need all inbound traffic to go via a static IP maybe, check out our inbound service also available on Heroku called QuotaGuard Static.
Option 1: Do it yourself
If you want to get involved with setting up and managing servers then it it is possible to set this up yourself using a traditional hosting provider like AWS, Rackspace or Digital Ocean.
Elad Ben-Israel has a blog post with more details on how to set up a proxy using Squid on AWS.
The Good Bits
- Control over how your proxy works and what traffic you allow through it.
The Ugly Truth
- All of a sudden you’re managing servers with all of the maintenance, monitoring and upgrade pain that it brings.
- What is your failover strategy? If your proxy is handling critical traffic then what happens when you’re AWS box falls over? At the very least you will need another box for a load balancer and one more for a backup proxy. Your maintenance load just got much worse.
Isn’t not worrying about this kind of problem why you moved to Heroku in the first place?
Option 2: Use a hosted proxy service
Ahhh, the “Heroku Way” – let other people worry about boring infrastructure so you can build awesome apps.
By using a hosted service like QuotaGuard Static you will be provided with a static IP that your traffic will route through. No server setup or management required. All you need to do is configure your app to direct the outbound traffic through the proxy server provided.
Available on the Heroku add-ons marketplace you can add QuotaGuard Static to your app in one click.
The Good Bits
- No infrastructure to manage
- Built in fault tolerance. With QuotaGuard Static you actually get a primary and secondary IP that are hidden behind a load balancer. This means that if one static IP fails traffic will automatically be routed through the secondary IP and your critical traffic is not affected.
The Ugly Truth
- It’s not free
We are always available to help if you have questions or setup/configuration issues. Write us any time at Support and we’ll be happy to get everything working for you.