Skip to content

Instantly share code, notes, and snippets.

@manuelmorales
Created November 18, 2013 12:52
Show Gist options
  • Save manuelmorales/7527288 to your computer and use it in GitHub Desktop.
Save manuelmorales/7527288 to your computer and use it in GitHub Desktop.
Echo HTTP server in sinatra
require 'sinatra'
set :port, 8080
get '/*' do
puts "[ECHO] #{request.host}:#{request.port}#{request.path}?#{request.user_agent}"
end
# redirect port 80 traffic with
# sudo iptables -t nat -I OUTPUT -p tcp -d 127.0.0.1 --dport 80 -j REDIRECT --to-ports 8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment