Heroku Static IP

How to Setup Static IP Heroku

Static IP Heroku can be done by using NGINX reverse proxy hosting on EC2 with an elastic IP address instance. Talenox is using static IP addresses for our biometric hardware devices to connect to our Heroku backend.

1. Launch an instance with your desired instance type. (Micro, Small, etc)

2. SSH into your instance to install NGINX

sudo apt-get update
sudo apt-get install nginx

3. Configure nginx. The proxy_set_header is the most important setting for it to work properly with Heroku, or you will face an error with “Heroku | No Such App”

        upstream backend  {

                server xxx.talenox.com;

        }

        server {

                listen          80;

                server_name     rpb1.talenox.com;

                location / {

                        proxy_pass              http://backend;

                        proxy_redirect          off;

                        proxy_set_header        X-Forwarded-For $remote_addr;

                        proxy_set_header        Host ‘xxxxx.herokuapp.com’;

                }

        }

4. nginx -s reload

Head to http://(your elastic ip address) and it should work!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.