You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Peter Rabbitson <ra...@rabbit.us> on 2007/08/31 15:45:07 UTC

[users@httpd] Is order of Location statements supposed to be significant?

Hello,

My goal is to allow any "Admin" user to access / of a virtual host, and 
any "Backup" user to access /backups of the same host. I have a user 
which is a member of the Admin group but not a member of the Backup 
group. If my configuration looks like this:

     <Location /> 
 

         AuthType Basic 
 

         AuthName "Restricted Admin area" 
 

         Require group Admin 
 

         AuthUserFile /etc/apache2/config/Passwd 
 

         AuthGroupFile /etc/apache2/config/Group 
 

     </Location>

     <Location /backups> 
 

         AuthType Basic 
 

         AuthName "Restricted Backup area" 
 

         Require group Backup 
 

         AuthUserFile /etc/apache2/config/Passwd 
 

         AuthGroupFile /etc/apache2/config/Group 
 

     </Location>

everything works as expected. However if the order of the Location 
statements is reversed (first /backups, then /) any member of Admin can 
access the entire site. I guess that the / is treated as a wildcard, and 
changes the previous Auth* settings of /backups.

My question is whether this is documented anywhere? I use a number of 
mod_macro statements all over my site and always believed that order of 
statements is not significant, only the nesting level. Now I am not sure 
how many more hidden problems I have in my configs.

Please point me to documentation in what circumstances the order of 
similar statements is significant, as my digging around the 2.2 manual 
proved fruitless.

Thank you

Peter
 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Is order of Location statements supposed to be significant?

Posted by Peter Rabbitson <ra...@rabbit.us>.
Joshua Slive wrote:
> On 8/31/07, Peter Rabbitson <ra...@rabbit.us> wrote:
>> Joshua Slive wrote:
>>> On 8/31/07, Peter Rabbitson <ra...@rabbit.us> wrote:
>>>
>>>> My question is whether this is documented anywhere? I use a number of
>>>> mod_macro statements all over my site and always believed that order of
>>>> statements is not significant, only the nesting level. Now I am not sure
>>>> how many more hidden problems I have in my configs.
>>>>
>>>> Please point me to documentation in what circumstances the order of
>>>> similar statements is significant, as my digging around the 2.2 manual
>>>> proved fruitless.
>>> See:
>>> http://httpd.apache.org/docs/2.2/sections.html#mergin
>>> and in particular the sentence:
>>> "Apart from <Directory>, each group is processed in the order that
>>> they appear in the configuration files."
>>>
>> So in other words I am responsible for ordering all directives "shortest
>> directive path first" except for Directory, which is reordered
>> automatically.
> 
> Yes. But in all likelihood, you should be using <Directory> and not
> <Location> in the first place. <Location> is for controlling URLs that
> aren't related to the filesystem. Therefore there is no real reason to
> believe that the arguments to <Location> will have a hierarchical
> file-system-like structure, so it wouldn't make sense for httpd to
> reorder them in that way.
> 

I need to control it exactly in such way because different access levels
are grouped by the URL location, not by the directories behind these
locations (some don't point to the filesystem at all). I don't think my
usage pattern warrants a bug, but it definitely is counter-intuitive.

Peter


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Is order of Location statements supposed to be significant?

Posted by Joshua Slive <jo...@slive.ca>.
On 8/31/07, Peter Rabbitson <ra...@rabbit.us> wrote:
> Joshua Slive wrote:
> > On 8/31/07, Peter Rabbitson <ra...@rabbit.us> wrote:
> >
> >> My question is whether this is documented anywhere? I use a number of
> >> mod_macro statements all over my site and always believed that order of
> >> statements is not significant, only the nesting level. Now I am not sure
> >> how many more hidden problems I have in my configs.
> >>
> >> Please point me to documentation in what circumstances the order of
> >> similar statements is significant, as my digging around the 2.2 manual
> >> proved fruitless.
> >
> > See:
> > http://httpd.apache.org/docs/2.2/sections.html#mergin
> > and in particular the sentence:
> > "Apart from <Directory>, each group is processed in the order that
> > they appear in the configuration files."
> >
>
> So in other words I am responsible for ordering all directives "shortest
> directive path first" except for Directory, which is reordered
> automatically.

Yes. But in all likelihood, you should be using <Directory> and not
<Location> in the first place. <Location> is for controlling URLs that
aren't related to the filesystem. Therefore there is no real reason to
believe that the arguments to <Location> will have a hierarchical
file-system-like structure, so it wouldn't make sense for httpd to
reorder them in that way.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Is order of Location statements supposed to be significant?

Posted by Peter Rabbitson <ra...@rabbit.us>.
Joshua Slive wrote:
> On 8/31/07, Peter Rabbitson <ra...@rabbit.us> wrote:
> 
>> My question is whether this is documented anywhere? I use a number of
>> mod_macro statements all over my site and always believed that order of
>> statements is not significant, only the nesting level. Now I am not sure
>> how many more hidden problems I have in my configs.
>>
>> Please point me to documentation in what circumstances the order of
>> similar statements is significant, as my digging around the 2.2 manual
>> proved fruitless.
> 
> See:
> http://httpd.apache.org/docs/2.2/sections.html#mergin
> and in particular the sentence:
> "Apart from <Directory>, each group is processed in the order that
> they appear in the configuration files."
> 

So in other words I am responsible for ordering all directives "shortest 
directive path first" except for Directory, which is reordered 
automatically.

Thank you.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Is order of Location statements supposed to be significant?

Posted by Joshua Slive <jo...@slive.ca>.
On 8/31/07, Peter Rabbitson <ra...@rabbit.us> wrote:

> My question is whether this is documented anywhere? I use a number of
> mod_macro statements all over my site and always believed that order of
> statements is not significant, only the nesting level. Now I am not sure
> how many more hidden problems I have in my configs.
>
> Please point me to documentation in what circumstances the order of
> similar statements is significant, as my digging around the 2.2 manual
> proved fruitless.

See:
http://httpd.apache.org/docs/2.2/sections.html#mergin
and in particular the sentence:
"Apart from <Directory>, each group is processed in the order that
they appear in the configuration files."

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org