Skip to content

Instantly share code, notes, and snippets.

@benwyrosdick
Last active February 5, 2016 00:56
Show Gist options
  • Save benwyrosdick/233dfff984f12b19731e to your computer and use it in GitHub Desktop.
Save benwyrosdick/233dfff984f12b19731e to your computer and use it in GitHub Desktop.
Password Protected Static Rack Site
# config.ru
use Rack::Auth::Basic, "Restricted Area" do |username, password|
[username, password] == ['admin', 'admin']
end
use Rack::Static, :urls => [""], :root => '.', :index => 'index.html'
run lambda { |env|
[
200,
{
'Content-Type' => 'text/html',
'Cache-Control' => 'public, max-age=0'
},
File.open('index.html', File::RDONLY)
]
}
gem 'rack'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment