Created
October 7, 2014 13:47
-
-
Save tliff/4d8a5e52a73272d0a1a0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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