Created
May 25, 2011 22:28
-
-
Save omnifroodle/992139 to your computer and use it in GitHub Desktop.
Rackup file for limiting access to a reverse proxied solr instance (thinking ajax)
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
# config.ru for solr reverse_proxy | |
# test me with $ rackup solrrp.ru | |
# or just do most of this in you web sever config | |
require 'server' | |
require 'rack/reverse_proxy' | |
require 'my_custom_logger' | |
# catch and log requests | |
use MyCustomLogger # some code you wrote that logs info about results on the /search* endpoint | |
use Rack::ReverseProxy do | |
# Forward only the path /search* to websolr | |
reverse_proxy /^\/search(.*)$/, 'http://example.com/solr/select$1' | |
end | |
# for dedicated solr permiter defense servers, include the following | |
# if you didn't get redirected, you've come to the wrong place | |
app = proc do |env| | |
[ 403, {'Content-Type' => 'text/plain'}, "not authorized" ] | |
end | |
run app |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment