Skip to content

Instantly share code, notes, and snippets.

@adamwiggins
Created September 10, 2009 00:46
Show Gist options
  • Save adamwiggins/184218 to your computer and use it in GitHub Desktop.
Save adamwiggins/184218 to your computer and use it in GitHub Desktop.
require 'sinatra'
before do
@refer = request.env['HTTP_REFERER']
m = (request.env['HTTP_REFERER'] || '').match(%r{https?://([^\/]+)/})
@refer_host = m ? m[1] : ''
end
get '/' do
@refer_host
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment