Skip to content

Instantly share code, notes, and snippets.

@jcalvert
Created March 2, 2012 20:18
Show Gist options
  • Save jcalvert/1961003 to your computer and use it in GitHub Desktop.
Save jcalvert/1961003 to your computer and use it in GitHub Desktop.
Sinatra IP filter?
before do
unless ['10','192','127'].include? request.ip.to_s.gsub /(.*?)\..*/,'\\1'
halt(404, "Not found") #I should probably throw 403, but in this case it's sensitive and I'd rather make like a hole.
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment