You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by André Warnier <aw...@ice-sa.com> on 2009/04/12 17:27:58 UTC

[users@httpd] Location, LocationMatch combinations

Hi.

Apache 2.2.x, configuration.
I have read this : http://httpd.apache.org/docs/2.2/sections.html
but some aspect is still not very clear to me.

If I have :

<Location "/zone1/private">
   .. some directives A ..
</Location>

<Location "/zone2/private">
   .. some directives B ..
</Location>

<LocationMatch "/private$">
   .. some directives C ..
</LocationMatch>

(The above URIs do not reside on the filesystem.)

If I access "http://myhost.company.com/zone1/private",
are the above directives A and C combined ?

Similarly if I access "http://myhost.company.com/zone2/private",
are the above directives B and C combined ?

If not, is there a way to combine them, more or less in the way 
indicated above ?

I guess that the basic question is : does Apache finally select one and 
only one Location/LocationMatch which applies, and then apply only the 
directives within that section, or does it accumulate/merge all that 
applies ?
 From the doc, I believe the latter, but it would be nice to have a 
definite confirmation by an expert.


Thanks for enlightenment.

---------------------------------------------------------------------
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] Location, LocationMatch combinations

Posted by André Warnier <aw...@ice-sa.com>.
Eric Covener wrote:
> On Sun, Apr 12, 2009 at 11:27 AM, André Warnier <aw...@ice-sa.com> wrote:
>> Hi.
>>
>> Apache 2.2.x, configuration.
>> I have read this : http://httpd.apache.org/docs/2.2/sections.html
>> but some aspect is still not very clear to me.
>>
>> If I have :
>>
>> <Location "/zone1/private">
>>  .. some directives A ..
>> </Location>
>>
>> <Location "/zone2/private">
>>  .. some directives B ..
>> </Location>
>>
>> <LocationMatch "/private$">
>>  .. some directives C ..
>> </LocationMatch>
> 
>> (The above URIs do not reside on the filesystem.)
>>
>> If I access "http://myhost.company.com/zone1/private",
>> are the above directives A and C combined ?
> 
> It depends on the directive, because each module merges their
> configuration between sections explicitly.
> 
> The ambiguous ones are the ones that are conceptually lists.  For
> example, adding a new DirectoryIndex or Require is interpreted as a
> fresh start even though one might expect/desire the opposite.
> Contrast with the various mod_mime directives (AddType, AddHandler,
> etc) which really are merged together from location to location.
> 
>> I guess that the basic question is : does Apache finally select one and only
>> one Location/LocationMatch which applies, and then apply only the directives
>> within that section, or does it accumulate/merge all that applies ?
>> From the doc, I believe the latter, but it would be nice to have a definite
>> confirmation by an expert.
> 
> They are merged two-at- a-time from lowest to highest priority, but it
> may ultimately look like the "last" one is selected depending on the
> directives (the final per-directory config can be treated as the
> verbatim config, or treated as a delta from the result of the previous
> merges)
> 
I'll bet that in your second life, you're a politician or a lawyer.
:-)
I'll interpret that as a "mostly merge, except that some 
modules/directives don't".
Thanks.

---------------------------------------------------------------------
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] Location, LocationMatch combinations

Posted by Eric Covener <co...@gmail.com>.
On Sun, Apr 12, 2009 at 11:27 AM, André Warnier <aw...@ice-sa.com> wrote:
> Hi.
>
> Apache 2.2.x, configuration.
> I have read this : http://httpd.apache.org/docs/2.2/sections.html
> but some aspect is still not very clear to me.
>
> If I have :
>
> <Location "/zone1/private">
>  .. some directives A ..
> </Location>
>
> <Location "/zone2/private">
>  .. some directives B ..
> </Location>
>
> <LocationMatch "/private$">
>  .. some directives C ..
> </LocationMatch>

>
> (The above URIs do not reside on the filesystem.)
>
> If I access "http://myhost.company.com/zone1/private",
> are the above directives A and C combined ?

It depends on the directive, because each module merges their
configuration between sections explicitly.

The ambiguous ones are the ones that are conceptually lists.  For
example, adding a new DirectoryIndex or Require is interpreted as a
fresh start even though one might expect/desire the opposite.
Contrast with the various mod_mime directives (AddType, AddHandler,
etc) which really are merged together from location to location.

> I guess that the basic question is : does Apache finally select one and only
> one Location/LocationMatch which applies, and then apply only the directives
> within that section, or does it accumulate/merge all that applies ?
> From the doc, I believe the latter, but it would be nice to have a definite
> confirmation by an expert.

They are merged two-at- a-time from lowest to highest priority, but it
may ultimately look like the "last" one is selected depending on the
directives (the final per-directory config can be treated as the
verbatim config, or treated as a delta from the result of the previous
merges)


-- 
Eric Covener
covener@gmail.com

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