Apache AuthDigestDomain and Rails Distributed Assets

I have a server that I am setting up on and I have an Apache configuration issue that I cannot get around.

I have Apache 2.2 and Passenger serving a Rails application with distributed resource hosting. This is a Rails feature that allows you to serve your static assets from assets0.example.com, assets1, assets2, etc.

The site must be encrypted prior to launch. I have set up HTTP Authentication on a site using Apache mod_auth_digest

. In my configuration, I am trying to use the AuthDigestDomain directive to allow access to each of the asset urls. The problem is, it doesn't work. When I load the page, I get an initial prompt for a password, but the first time I load an asset from one of the asset URLs, I will be prompted for a 2nd, 3rd, or 4th time. In some browsers, I get a request for every resource on the page.

I hope this is just a problem with the way I am specifying my directives and not an authorization restriction in Apache. See the edited authorization 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>

      

0


source to share


1 answer


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



  • 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/
    
          

    Pay attention to the "http: //"?

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

0


source







All Articles