Using Apache's auth to protect RoRs sites

I just started using RoR to make a front end for a much larger app that
I am coding, and I’ve run into a wall. I need apache to authenticate
users, and have the username available to the ruby code. (password
doesn’t matter) I’ve seen a lot of things that do everything from
within ruby, but I need to be able to use Apache’s auths.

Here is what I’ve tried:

RewriteRule ^(.*)$ dispatch.fcgi
[E=X-HTTP_AUTHORIZATION:%{HTTP:Authorization},QSA,L] in .htaccess in the
public folder

with

AuthName “Merj”
AuthType Basic
Require valid-user

at the top.

or with

<Directory /Library/WebServer/merj/public/>
Options ExecCGI FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all

AuthName "Merj"
AuthType Basic


Require valid-user

in httpd.conf.

If ssl is required, that is a non-issue, as it’s destination has it, I’m
just coding it all on my laptop.

With all of thse,
Ruby version 1.8.2 (universal-darwin8.0)
RubyGems version 0.9.0
Rails version 1.1.6
Active Record version 1.14.4
Action Pack version 1.12.5
Action Web Service version 1.1.6
Action Mailer version 1.2.5
Active Support version 1.3.1
Application root /Library/WebServer/merj
Environment development
Database adapter mysql

is replaced by

nternal Server Error
The server encountered an internal error or misconfiguration and was
unable to complete your request.

Thanks a ton. I’m finding RoR quite handy.

Jonathan

Jonathan D. wrote:

I just started using RoR to make a front end for a much larger app that
I am coding, and I’ve run into a wall. I need apache to authenticate
users, and have the username available to the ruby code.

request.env[‘REMOTE_USER’]

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs