Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to whitelist Heroku apps?

I have a Heroku application that binds with a telco sms gateway via SMPP The telco guys need to whitelist IPs for my app to connect. I am aware of the new addon proximo, but it's just insanely priced. So that option is out. Is there a subnet or a list of IPs that I can get whitelisted and is there a guarantee that all requests from my app will originate from tose IPs? I found this https://api.heroku.com/vendor/logplex/allowlist. Is that only for syslog or all apps make a request from one of those IPs?

Thanks

like image 609
gsin Avatar asked Aug 18 '12 11:08

gsin


2 Answers

You can host a proxy yourself using Dockhero Heroku add-on - https://dockhero.io/ - which has a static IP (AWS elastic IP).

  1. Install the add-on and the CLI plugin:

    $ heroku addons:create dockhero
    $ heroku plugins:install dockhero
    
  2. Wait until the provisioning is done and get DOCKHERO_HOST environment variable

    $ heroku dh:wait
    $ heroku config:get DOCKHERO_HOST
    --> e.g. dockhero-spherical-42047.dockhero.io
    
  3. Create dockhero-compose.yml file with the following contents:

    version: "2"
    services:
      proxy:
        image: tecnativa/tcp-proxy
        environment:
          LISTEN: ":80"
          TALK: "www.wikipedia.org:80"
        ports: 
          - "80:80"
    

Here www.wikipedia.org:80 is the server which you build a proxy for. Find more about the syntax in https://docs.docker.com/compose/compose-file/compose-file-v2/

  1. Run this stack in the cloud using Dockhero CLI:

    $ heroku dh:compose up -d
    
  2. Any requests to the host from DOCKHERO_HOST Heroku config var will now be proxied according to your dockhero-compose.yml

    $ curl http://dockhero-spherical-42047.dockhero.io/
    --> <response from www.wikipedia.org> 
    

IMPORTANT: as of writing this, dockhero.io is in Beta and available for free. When switching to production, the assigned IP may be changed after a prior notification.

like image 114
user670908 Avatar answered Sep 21 '22 13:09

user670908


Fixie is another alternative add-on not mentioned here. Free plan with 500 requests per month. Requires some adjustments in code and heroku app to be in us region (or you can migrate it: Migrating an Application to Another Region). Worked for me.

like image 21
kostek Avatar answered Sep 21 '22 13:09

kostek