Password protect resque-web

1.1k Views Asked by At

I'm running php-resque with PHP and have installed resque-web to use the admin interface.

Problem: How do you password protect the resque-web pages? I am not familiar with Ruby/Rails/Sinatra so a solution that does not require much knowledge of them will be perfect!

2

There are 2 best solutions below

0
On

The simpliest way to protect a webpage or directory with a password is a .htaccess/.htpasswd file.

To create those files, you could use a online generator like this

1
On

You can use Resque::Auth::Basic -- just specify something like this in your config.ru:

map "/resque" do
  use Rack::Auth::Basic do |username, password|
    [username, password] == ['admin', 'admin']
    end
  run Resque::Server.new
end

NOTE :

/resque is the path where I wanted to mount resque-web but you can choose your own.

There are also other ways to do it but this is the basic approach.

Hope this

EDIT

Oh, you mean you don't have a Sinatra application at all? Well. that would be pain. Then there are 2 approaches you can use:

a) define a config.ru file and write the code above in it and do this: rackup config.ru -p 3001 and redirect(proxy-pass) the /resque via web-server to that URL

b) I recommend you apply your BASIC AUTH ON web-server itself (I know nginx has it check this sure Apache or Lighthttpd would also have the same)

I hope now it makes sense.