Skip to content

Instantly share code, notes, and snippets.

@jdeathe
Last active February 22, 2017 14:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jdeathe/eb05a3b359edf193279408649beb1e73 to your computer and use it in GitHub Desktop.
Save jdeathe/eb05a3b359edf193279408649beb1e73 to your computer and use it in GitHub Desktop.
Share an internal https (encrypted) host with a publicly accessible URL using http (unencrypted) using socat and ngrok.

Test an Internal HTTPS Host using HTTP on a Public Network.

Limitations

This does not rewrite URLs like a reverse proxy but can be useful for viewing a single page.

Install tools

socat

OSX - install with Homebrew

$ brew install socat

RHEL/CentOS

$ yum install socat

ngrok

Set up the route

Export the internal host's name or IP address

$ export HOST=internal.localdomain

Using socat you can decrypt the encrypted address.

$ sudo socat TCP4-LISTEN:80,fork,reuseaddr OPENSSL:${HOST}:443,verify=0

In another terminal window/tab run ngrok so you can access the intenal host from a publically accessible address.

$ ngrok http -host-header=${HOST} 127.0.0.1:80

References:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment