home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 November / CMCD1104.ISO / Software / Complet / Apache / apache_2.0.52-win32-x86-no_ssl.msi / Data.Cab / F278306_mod_headers.xml < prev    next >
Extensible Markup Language  |  2004-08-19  |  12KB  |  299 lines

  1. <?xml version="1.0"?>
  2. <!DOCTYPE modulesynopsis SYSTEM "../style/modulesynopsis.dtd">
  3. <?xml-stylesheet type="text/xsl" href="../style/manual.en.xsl"?>
  4. <!-- $Revision: 1.5.2.6 $ -->
  5.  
  6. <!--
  7.  Copyright 2002-2004 The Apache Software Foundation
  8.  
  9.  Licensed under the Apache License, Version 2.0 (the "License");
  10.  you may not use this file except in compliance with the License.
  11.  You may obtain a copy of the License at
  12.  
  13.      http://www.apache.org/licenses/LICENSE-2.0
  14.  
  15.  Unless required by applicable law or agreed to in writing, software
  16.  distributed under the License is distributed on an "AS IS" BASIS,
  17.  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18.  See the License for the specific language governing permissions and
  19.  limitations under the License.
  20. -->
  21.  
  22. <modulesynopsis metafile="mod_headers.xml.meta">
  23.  
  24. <name>mod_headers</name>
  25. <description>Customization of HTTP request and response
  26. headers</description>
  27. <status>Extension</status>
  28. <sourcefile>mod_headers.c</sourcefile>
  29. <identifier>headers_module</identifier>
  30. <compatibility><directive module="mod_headers">RequestHeader</directive>
  31. is available only in Apache 2.0</compatibility>
  32.  
  33. <summary>
  34.     <p>This module provides directives to control and modify HTTP
  35.     request and response headers. Headers can be merged, replaced
  36.     or removed.</p>
  37. </summary>
  38.  
  39. <section id="order"><title>Order of Processing</title>
  40.  
  41.     <p>The directives provided by <module>mod_headers</module> can occur
  42.     almost anywhere within the server configuration. They are valid in the
  43.     main server config and virtual host sections, inside
  44.     <directive module="core" type="section">Directory</directive>,
  45.     <directive module="core" type="section">Location</directive> and 
  46.     <directive module="core" type="section">Files</directive> sections,
  47.     and within <code>.htaccess</code> files.</p>
  48.  
  49.     <p>The directives are processed in the following order:</p>
  50.  
  51.     <ol>
  52.       <li>main server</li>
  53.       <li>virtual host</li>
  54.       <li><directive type="section">Directory</directive> sections and
  55.       <code>.htaccess</code></li>
  56.       <li><directive type="section">Files</directive></li>
  57.       <li><directive type="section">Location</directive></li>
  58.     </ol>
  59.  
  60.     <p>Order is important. These two headers have a different
  61.     effect if reversed:</p>
  62.  
  63.     <example>
  64.       RequestHeader append MirrorID "mirror 12"<br />
  65.       RequestHeader unset MirrorID
  66.     </example>
  67.  
  68.     <p>This way round, the <code>MirrorID</code> header is not set. If
  69.     reversed, the MirrorID header is set to "mirror 12".</p>
  70. </section>
  71.  
  72. <section id="examples"><title>Examples</title>
  73.  
  74.     <ol>
  75.       <li>
  76.         Copy all request headers that begin with "TS" to the
  77.         response headers:
  78.  
  79.         <example>
  80.           Header echo ^TS
  81.         </example>
  82.       </li>
  83.  
  84.       <li>
  85.         Add a header, <code>MyHeader</code>, to the response including a
  86.         timestamp for when the request was received and how long it
  87.         took to begin serving the request. This header can be used by
  88.         the client to intuit load on the server or in isolating
  89.         bottlenecks between the client and the server.
  90.  
  91.         <example>
  92.           Header add MyHeader "%D %t"
  93.         </example>
  94.  
  95.         <p>results in this header being added to the response:</p>
  96.  
  97.         <example>
  98.           MyHeader: D=3775428 t=991424704447256
  99.         </example>
  100.       </li>
  101.  
  102.       <li>
  103.         Say hello to Joe
  104.  
  105.         <example>
  106.           Header add MyHeader "Hello Joe. It took %D microseconds \<br />
  107.           for Apache to serve this request."
  108.         </example>
  109.  
  110.         <p>results in this header being added to the response:</p>
  111.  
  112.         <example>
  113.           MyHeader: Hello Joe. It took D=3775428 microseconds for Apache
  114.           to serve this request.
  115.         </example>
  116.       </li>
  117.  
  118.       <li>
  119.         Conditionally send <code>MyHeader</code> on the response if and
  120.         only if header "MyRequestHeader" is present on the request. This
  121.         is useful for constructing headers in response to some client
  122.         stimulus. Note that this example requires the services of the
  123.         <module>mod_setenvif</module> module.
  124.  
  125.         <example>
  126.           SetEnvIf MyRequestHeader value HAVE_MyRequestHeader<br />
  127.           Header add MyHeader "%D %t mytext" env=HAVE_MyRequestHeader<br />
  128.        </example>
  129.  
  130.        <p>If the header <code>MyRequestHeader: value</code> is present on
  131.        the HTTP request, the response will contain the following header:</p>
  132.  
  133.        <example>
  134.          MyHeader: D=3775428 t=991424704447256 mytext
  135.        </example>
  136.       </li>
  137.     </ol>
  138. </section>
  139.  
  140. <directivesynopsis>
  141. <name>RequestHeader</name>
  142. <description>Configure HTTP request headers</description>
  143. <syntax>RequestHeader set|append|add|unset <var>header</var>
  144. [<var>value</var>]</syntax>
  145. <contextlist><context>server config</context><context>virtual host</context>
  146. <context>directory</context><context>.htaccess</context></contextlist>
  147. <override>FileInfo</override>
  148.  
  149. <usage>
  150.     <p>This directive can replace, merge or remove HTTP request
  151.     headers. The header is modified just before the content handler
  152.     is run, allowing incoming headers to be modified. The action it
  153.     performs is determined by the first argument. This can be one
  154.     of the following values:</p>
  155.  
  156.     <dl>
  157.     <dt><code>set</code></dt>
  158.     <dd>The request header is set, replacing any previous header
  159.     with this name</dd>
  160.  
  161.     <dt><code>append</code></dt>
  162.     <dd>The request header is appended to any existing header of the
  163.     same name. When a new value is merged onto an existing header
  164.     it is separated from the existing header with a comma. This
  165.     is the HTTP standard way of giving a header multiple
  166.     values.</dd>
  167.  
  168.     <dt><code>add</code></dt>
  169.     <dd>The request header is added to the existing set of headers,
  170.     even if this header already exists. This can result in two
  171.     (or more) headers having the same name. This can lead to
  172.     unforeseen consequences, and in general <code>append</code> should be
  173.     used instead.</dd>
  174.  
  175.     <dt><code>unset</code></dt>
  176.     <dd>The request header of this name is removed, if it exists. If
  177.     there are multiple headers of the same name, all will be removed.</dd>
  178.     </dl>
  179.  
  180.     <p>This argument is followed by a header name, which can
  181.     include the final colon, but it is not required. Case is
  182.     ignored. For <code>add</code>, <code>append</code> and
  183.     <code>set</code> a <var>value</var> is given as the third argument. If
  184.     <var>value</var> contains spaces, it should be surrounded by double
  185.     quotes. For unset, no <var>value</var> should be given.</p>
  186.  
  187.     <p>The <directive>RequestHeader</directive> directive is processed
  188.     just before the request is run by its handler in the fixup phase.
  189.     This should allow headers generated by the browser, or by Apache
  190.     input filters to be overridden or modified.</p>
  191. </usage>
  192. </directivesynopsis>
  193.  
  194. <directivesynopsis>
  195. <name>Header</name>
  196. <description>Configure HTTP response headers</description>
  197. <syntax>Header [<var>condition</var>] set|append|add|unset|echo
  198. <var>header</var> [<var>value</var>] [env=[!]<var>variable</var>]</syntax>
  199. <contextlist><context>server config</context><context>virtual host</context>
  200. <context>directory</context><context>.htaccess</context></contextlist>
  201. <override>FileInfo</override>
  202. <compatibility><var>Condition</var> is available in version 2.0.51 and
  203. later</compatibility>
  204.  
  205. <usage>
  206.     <p>This directive can replace, merge or remove HTTP response
  207.     headers. The header is modified just after the content handler
  208.     and output filters are run, allowing outgoing headers to be
  209.     modified.</p>
  210.  
  211.     <p>The optional <var>condition</var> can be either <code>onsuccess</code>
  212.     or <code>always</code>. It determines, which internal header table should be
  213.     operated on. <code>onsuccess</code> stands for <code>2<var>xx</var></code>
  214.     status codes and <code>always</code> for all status codes (including
  215.     <code>2<var>xx</var></code>). Especially if you want to unset headers
  216.     set by certain modules, you should try out, which table is affected.</p>
  217.  
  218.     <p>The action it performs is determined by the second
  219.     argument. This can be one of the following values:</p>
  220.  
  221.     <dl>
  222.     <dt><code>set</code></dt>
  223.     <dd>The response header is set, replacing any previous header
  224.     with this name. The <var>value</var> may be a format string.</dd>
  225.  
  226.     <dt><code>append</code></dt>
  227.     <dd>The response header is appended to any existing header of
  228.     the same name. When a new value is merged onto an existing
  229.     header it is separated from the existing header with a comma.
  230.     This is the HTTP standard way of giving a header multiple values.</dd>
  231.  
  232.     <dt><code>add</code></dt>
  233.     <dd>The response header is added to the existing set of headers,
  234.     even if this header already exists. This can result in two
  235.     (or more) headers having the same name. This can lead to
  236.     unforeseen consequences, and in general "append" should be
  237.     used instead.</dd>
  238.  
  239.     <dt><code>unset</code></dt>
  240.     <dd>The response header of this name is removed, if it exists.
  241.     If there are multiple headers of the same name, all will be
  242.     removed.</dd>
  243.  
  244.     <dt><code>echo</code></dt>
  245.     <dd>Request headers with this name are echoed back in the
  246.     response headers. <var>header</var> may be a regular expression.</dd>
  247.     </dl>
  248.  
  249.     <p>This argument is followed by a <var>header</var> name, which
  250.     can include the final colon, but it is not required. Case is
  251.     ignored for <code>set</code>, <code>append</code>, <code>add</code>
  252.     and <code>unset</code>. The <var>header</var> name for <code>echo</code>
  253.     is case sensitive and may be a regular expression.</p>
  254.  
  255.     <p>For <code>add</code>, <code>append</code> and <code>set</code> a
  256.     <var>value</var> is specified as the third argument. If <var>value</var>
  257.     contains spaces, it should be surrounded by doublequotes.
  258.     <var>value</var> may be a character string, a string containing format
  259.     specifiers or a combination of both. The following format specifiers
  260.     are supported in <var>value</var>:</p>
  261.  
  262.     <table border="1">
  263.     <columnspec><column width=".25"/><column width=".75"/></columnspec>
  264.     <tr><td><code>%t</code></td>
  265.         <td>The time the request was received in Universal Coordinated Time
  266.         since the epoch (Jan. 1, 1970) measured in microseconds. The value
  267.         is preceded by <code>t=</code>.</td></tr>
  268.  
  269.     <tr><td><code>%D</code></td>
  270.         <td>The time from when the request was received to the time the
  271.         headers are sent on the wire. This is a measure of the duration
  272.         of the request. The value is preceded by <code>D=</code>.</td></tr>
  273.  
  274.     <tr><td><code>%{FOOBAR}e</code></td>
  275.         <td>The contents of the <a href="../env.html">environment
  276.         variable</a> <code>FOOBAR</code>.</td></tr>
  277.     </table>
  278.  
  279.     <p>When the <directive>Header</directive> directive is used with the
  280.     <code>add</code>, <code>append</code>, or <code>set</code>
  281.     argument, a fourth argument may be used to specify conditions
  282.     under which the action will be taken. If the <a
  283.     href="../env.html">environment variable</a> specified in the
  284.     <code>env=...</code> argument exists (or if the environment
  285.     variable does not exist and <code>env=!...</code> is specified)
  286.     then the action specified by the <directive>Header</directive> directive
  287.     will take effect. Otherwise, the directive will have no effect
  288.     on the request.</p>
  289.  
  290.     <p>The <directive>Header</directive> directives are processed just
  291.     before the response is sent to the network. These means that it is
  292.     possible to set and/or override most headers, except for those headers
  293.     added by the header filter.</p>
  294. </usage>
  295. </directivesynopsis>
  296.  
  297. </modulesynopsis>
  298.  
  299.