Apache's AuthDigestDomain and Rails Distributed Asset Hosts

Posted by Jared on Stack Overflow See other posts from Stack Overflow or by Jared
Published on 2009-01-08T17:26:46Z Indexed on 2010/05/12 10:04 UTC
Read the original article Hit count: 149

I've got a server I'm in the process of setting up and I'm running into an Apache configuration problem that I can not get around.

I've got Apache 2.2 and Passenger serving a Rails app with distributed asset hosting. This is the feature of Rails that lets you serve your static assets from assets0.example.com, assets1, assets2, and so on.

The site needs to be passworded until launch. I've set up HTTP authentication on the site using Apache's mod_auth_digest. In my configuration I'm attempting to use the AuthDigestDomain directive to allow access to each of the asset URLs. The problem is, it doesn't seem to be working. I get the initial prompt for the password when I load the page, but then the first time it loads an asset from one of the asset URLs, I get prompted a 2nd, 3rd, or 4th time. In some browsers, I get prompted for every single resource on the page.

I'm hoping that this is only a problem of how I'm specifying my directives and not a limitation of authorization in Apache itself. See the edited auth section below:

<Location />
  AuthType Digest
  AuthName "Restricted Site"
  AuthUserFile /etc/httpd/passwd/passwords
  AuthGroupFile /dev/null
  AuthDigestDomain / http://assets0.example.com/ http://assets1.example.com/ http://assets2.example.com/ http://assets3.example.com/
  require valid-user
  order deny,allow
  allow from all
</Location>

© Stack Overflow or respective owner

Related posts about apache

Related posts about authentication