Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm wondering if the following code should be working:

<LocationMatch "/(.*)([/])?(.*)">
    Order allow,deny
    Allow from all

    AuthType Basic
    AuthName "Git"
    AuthUserFile  /git/.htpasswd
    AuthGroupFile /git/.htgroup
    Require group $1
</LocationMatch>

What I am trying to achieve with this is to require a group based on the first regex variable. So if the user goes to http://localhost/a-repository-name he has to be in the group a-repository-name to be able to open the url.

For some reason I can't get this code working and apache returns: Authorization of user **** to access /a-repository-name failed, reason: user is not part of the 'require'ed group(s).
I guess it's not matching against the proper variable at Require group $1.
Is this the right way to be done or I'm missing something?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

LocationMatch doesn't support backreferencing, you can't do that.

share|improve this answer
    
Can you please provide a link in the documentation where this is stated? I changed Require group $1 to Require group mygroup and it worked perfect. –  tftd Sep 3 '12 at 15:04
    
@tftd: Changed the wording. I meant regexp grouping, not the group you set in Require. –  InternetSeriousBusiness Sep 3 '12 at 15:07
    
Is there any known workaround? –  tftd Sep 3 '12 at 15:30
    
@tftd: I'm afraid you'll have to attack the problem from another angle. –  InternetSeriousBusiness Sep 3 '12 at 17:12
    
Okey, thanks for the help! :) –  tftd Sep 3 '12 at 20:28

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.