Skip to content

Instantly share code, notes, and snippets.

@colejhudson
Created April 25, 2018 22:53
Show Gist options
  • Select an option

  • Save colejhudson/c5c8dd289431ad8ed5621ed678ff3d91 to your computer and use it in GitHub Desktop.

Select an option

Save colejhudson/c5c8dd289431ad8ed5621ed678ff3d91 to your computer and use it in GitHub Desktop.
Simple Protocol Independent Reverse Proxy
#!/usr/bin/env bash
function proxy() {
local PUBLIC_PORT="80"
local LOCAL_HOST="127.0.0.1"
local LOCAL_PORT="8080"
mkfifo socket
sudo nc -kl ${1=PUBLIC_PORT} 0<socket | nc ${2=LOCAL_HOST} ${3=LOCAL_PORT} 1>socket
rm socket
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment