Bug 65056 - some ideas how to better describe the merging of sections
Summary: some ideas how to better describe the merging of sections
Status: NEW
Alias: None
Product: Apache httpd-2
Classification: Unclassified
Component: Documentation (show other bugs)
Version: 2.5-HEAD
Hardware: All All
: P2 enhancement (vote)
Target Milestone: ---
Assignee: HTTP Server Documentation List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-05 01:57 UTC by Christoph Anton Mitterer
Modified: 2021-01-05 02:14 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Anton Mitterer 2021-01-05 01:57:48 UTC
Hey.

In en/sections.html "How the sections are merged" section it's very nicely described how sections are merged.

I would however add the following (if true ;-) ):

1) For "* <Directory> (group 1 above) is processed in the order shortest directory component to longest." I would add something like "(regardless of their order in the configuration)" ... since this is the main point here that makes it different from the other sections.


2) A bit below it explains:
"If multiple <Directory> sections apply to the same directory they are processed in the configuration file order."

This should perhaps be expanded to (nearly) all the other section-directives, e.g. with a 2nd sentence like:
"This is also the case when two or more of <DirectoryMatch>, <File>, <FileMatch>, <Location>, <LocationMatch> apply to the very same resource."

And I guess for <If> as well?


3) Similarly than (2), it should perhaps mention that this is NOT ALWAYS the case for <VirtualHost> sections, i.e. if two or more <VirtualHost> have the very same literal address:port (or address:*, *:port or *:*) AND none of them can be chosen by name-based vhosting (via. differing ServerName/ServerAlias) ONLY the first of them appearing in the configuration will be taken.

I know this is already explained in more detail in the vhosting guides, but since this (en/sections.html "How the sections are merged") is the documentation part serving as a cheat sheet for how merging is done, it should perhaps not miss from there.


HTH,
Chris
Comment 1 Christoph Anton Mitterer 2021-01-05 02:14:12 UTC
Follow up on (3):

Maybe a simply way to describe this for <VirtualHost> would be:

For <VirtualHost>, if there are multiple sections that match on the very same specifier, e.g.:
- two or more of <VirtualHost address:port>
- two or more of <VirtualHost address:*>
- two or more of <VirtualHost *:port>
- two or more of <VirtualHost *:*>

HTTPD would (after is has ruled out all vhosts that aren't a best-match, see vhosting Tutorial), within each of the above groups, first look whether one <VirtualHost> can be picked based on name-based vhosting (via ServerName/ServerAlias) and if not possible, take the first <VirtualHost> in the configuration (or fall back to the main server).
In no case it would finally consider directives from more than one <VirtualHost> section.