Skip to content

Instantly share code, notes, and snippets.

@ljfauscett
Created February 5, 2014 07:23
Show Gist options
  • Save ljfauscett/8818770 to your computer and use it in GitHub Desktop.
Save ljfauscett/8818770 to your computer and use it in GitHub Desktop.
require 'webrick'
PORT = 7999
server = WEBrick::HTTPServer.new(
Port: PORT,
BindAddress: '0.0.0.0',
Logger: WEBrick::Log.new('/dev/null')
)
server.mount_proc '/' do |req, res|
res.body = 'Hello, forward!'
end
%w[INT TERM].each do |signal|
trap(signal) { server.shutdown }
end
puts "\033[32mServer started on port #{PORT}, run `forward #{PORT}' in another terminal window to start a tunnel.\033[0m"
server.start
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment