From: Luca Toscano Date: Fri, 19 Feb 2016 08:05:22 +0000 (+0000) Subject: Documentation rebuild X-Git-Tag: 2.4.19~173 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=489f54581f0cdb56b2be4fba5f0b0569dc079062;p=apache Documentation rebuild git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1731195 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/docs/manual/sections.html.en b/docs/manual/sections.html.en index 5e115c518e..33ce214887 100644 --- a/docs/manual/sections.html.en +++ b/docs/manual/sections.html.en @@ -361,12 +361,12 @@ see the Virtual Host Documentation.

and <ProxyMatch> containers apply enclosed configuration directives only to sites accessed through mod_proxy's proxy server -that match the specified URL. For example, the following configuration -will prevent the proxy server from being used to access the -www.example.com website.

+that match the specified URL. For example, the following configuration +will allow only a subset of clients to access the +www.example.com website using the proxy server:

<Proxy "http://www.example.com/*">
-    Require all granted
+    Require host yournetwork.example.com
 </Proxy>
top
@@ -452,14 +452,7 @@ are interpreted, it is important to understand how this works.

container takes the place of the <Directory> container in the processing order.

-

Later sections override earlier ones, however each module is responsible - for interpreting what form this override takes. A later configuration section - with directives from a given module might cause a conceptual "merge" of some - directives, all directives, or a complete replacement of the modules - configuration with the module defaults and directives explicitly listed in - the later context.

- -

Technical Note

+

Technical Note

There is actually a <Location>/<LocationMatch> sequence performed just before the name translation phase @@ -467,9 +460,50 @@ are interpreted, it is important to understand how this works.

are used to map URLs to filenames). The results of this sequence are completely thrown away after the translation has completed. -
+
+ +

Relationship between modules and configuration sections

+

One question that often arises after reading how configuration sections are + merged is related to how and when directives of specific modules like mod_rewrite + are processed. The answer is not trivial and needs a bit of background. + Each httpd module manages its own configuration, and each of its directives in httpd.conf specify one piece + of configuration in a particular context. httpd does not execute a command as it is read.

+

At runtime, the core of httpd iterates over the defined configuration sections in the order + described above to determine which ones apply to the current request. When the first section matches, + it is considered the current configuration for this request. If a subsequent section matches too, + then each module with a directive in either of the sections is given a chance to merge its configuration between the two sections. The result is a third configuration, and the process goes on until all the configuration sections + are evaluated.

+

After the above step, the "real" processing of the HTTP request begins: each module has a chance to run + and perform whatever tasks they like. They can retrieve their own final merged configuration from the core + of the httpd to determine how they should act.

+

An example can help to visualize the whole process. The following configuration uses the + Header directive of mod_headers to set + a specific HTTP header. What value will httpd set in the CustomHeaderName header for a request to + /example/index.html ? +

+
<Directory "/">
+    Header set CustomHeaderName one
+    <FilesMatch ".*">
+        Header set CustomHeaderName three
+    </FilesMatch>
+</Directory>
 
-

Some Examples

+<Directory "/example"> + Header set CustomHeaderName two +</Directory>
+ + + +

This is true for .htaccess too since they have the same priority as Directory in the merge order. The important concept to understand is that configuration sections like Directory and FilesMatch are not comparable to module specific directives like Header or RewriteRule because they operate on different levels. +

+ + +

Some useful examples

Below is an artificial example to show the order of merging. Assuming they all apply to the request, the directives in @@ -499,6 +533,7 @@ E.

</Directory> +

For a more concrete example, consider the following. Regardless of any access restrictions placed in <Directory> sections, the <Location> section will be evaluated last and will allow unrestricted access to the server. In