Skip to content

Instantly share code, notes, and snippets.

@tliff
Created October 7, 2014 13:47
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 tliff/4d8a5e52a73272d0a1a0 to your computer and use it in GitHub Desktop.
Save tliff/4d8a5e52a73272d0a1a0 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
require 'net/dns'
require 'sinatra'
get '*' do
begin
data = Resolver("_redirect.#{request.host}", Net::DNS::TXT).each_mx.map(&:txt).first
code, rest = data.split(' ')
redirect(rest, code)
rescue
redirect('http://www.idowa.de', 302)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment