Skip to content

Instantly share code, notes, and snippets.

@velizarn
Last active November 24, 2020 13:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save velizarn/299d37132af84279f7ef337e7d2f5743 to your computer and use it in GitHub Desktop.
Save velizarn/299d37132af84279f7ef337e7d2f5743 to your computer and use it in GitHub Desktop.
Get IP from inside a Heroku app

Create getip.sh bash script:

#!/usr/bin/env bash
curl -s https://httpbin.org/ip | grep -oP '(?<="origin": ")[^"]*'

then execute following command

> bash ./getip.sh

OR if you have installed jq library on your instance just run following command:

> curl -s https://httpbin.org/ip | jq '.origin'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment