Mimic .htaccess or some other type of password protecting with webrick?

You can restrict access by using Rack based basic auth or IP white listing Basic Auth Add the following to your config/environments/development. Rb config.middleware. Use Rack::Auth::Basic, "Beta Access" do |username, password| 'secret' == password end IP White Listing I found two gems for this purpose: rack-auth-ip rack-ip-whitelist I would use rack-auth-ip as it has been there for some time.

Add the following to your config/environments/development. Rb config.middleware. Use Rack::Auth::IP, %w( YourIPAddress ) Now, the instance is accessible only if the originating IP is in the white list.

I have added a section for basic auth in my answer, take a look. – KandadaBoggu Nov 21 at 23:41.

This question Ruby Webrick HTTP Authentication seems to give an answer Here's a link to some Webrick docs. It looks like you need something like so, from the above link: realm = "Gnome's realm" start_webrick {|server| server. Mount_proc('/convenient_basic_auth') {|req, resp| HTTPAuth.

Basic_auth(req, resp, realm) {|user, pass| # this block returns true if # authentication token is valid user == 'gnome' && pass == 'supersecretpassword' } resp. Body = "You are authenticated to see the super secret data\n" } } and a link to the rdocon WEBrick/HTTPAuth config = { :Realm => 'DigestAuth example realm' } htpasswd = WEBrick::HTTPAuth::Htpasswd. New 'my_password_file' htpasswd.

Auth_type = WEBrick::HTTPAuth::DigestAuth htpasswd. Set_passwd config:Realm, 'username', 'password' htpasswd.flush.

– austinbv Nov 18 at 23:18 It does appear that way. – Paul Rubel Nov 19 at 2:15 that is a pain in the rear for development code. – austinbv Nov 19 at 14:52.

Unless you're stuck using WEBrick, a better solution would be to use nginx which proxys to unicorn. Here is a good tutorial: here.

Class ApplicationController "dhh", :password => "hatezgroupon", :if => lambda { Rails.env. Development? } end.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions