views:

624

answers:

2

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>
A: 

I never used cross-domain authentication with apache before. But:

  1. The Apache documentation uses a syntax different from yours:

    AuthDigestDomain / assets0.example.com/ assets1.example.com/ assets2.example.com/ assets3.example.com/
    AuthDigestDomain /private/ http://mirror.my.dom/private2/
    

    Notice the 'http://'?

  2. The documentation also contains some caveats about browser support. Are you sure your browser can handle this?

innaM
I've edited my original post to reflect the Apache syntax because I did in fact try that and without success. I've actually just given up on asset hosts while the site is passworded. I'll just have to remember to turn it back on before launch.
Jared
A: 

Hey, I am having the same problem. Did you solve it?

I never did solve the problem, and I don't believe you can. I don't remember where I read it, but I do remember reading that there is was no way to do this. If you find otherwise in a newer version of Apache, please post back here.
Jared