313 lines
18 KiB
HTML
313 lines
18 KiB
HTML
|
<?xml version="1.0" encoding="UTF-8"?>
|
||
|
<!DOCTYPE html
|
||
|
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
|
<html lang="en-us" xml:lang="en-us">
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||
|
<meta name="security" content="public" />
|
||
|
<meta name="Robots" content="index,follow" />
|
||
|
<meta http-equiv="PICS-Label" content='(PICS-1.1 "http://www.icra.org/ratingsv02.html" l gen true r (cz 1 lz 1 nz 1 oz 1 vz 1) "http://www.rsac.org/ratingsv01.html" l gen true r (n 0 s 0 v 0 l 0) "http://www.classify.org/safesurf/" l gen true r (SS~~000 1))' />
|
||
|
<meta name="DC.Type" content="topic" />
|
||
|
<meta name="DC.Title" content="Module mod_headers" />
|
||
|
<meta name="copyright" content="(C) Copyright IBM Corporation 2002,2006" />
|
||
|
<meta name="DC.Rights.Owner" content="(C) Copyright IBM Corporation 2002,2006" />
|
||
|
<meta name="DC.Format" content="XHTML" />
|
||
|
<meta name="DC.Identifier" content="rzaiemod_headers" />
|
||
|
<meta name="DC.Language" content="en-us" />
|
||
|
<!-- All rights reserved. Licensed Materials Property of IBM -->
|
||
|
<!-- US Government Users Restricted Rights -->
|
||
|
<!-- Use, duplication or disclosure restricted by -->
|
||
|
<!-- GSA ADP Schedule Contract with IBM Corp. -->
|
||
|
<link rel="stylesheet" type="text/css" href="./ibmdita.css" />
|
||
|
<link rel="stylesheet" type="text/css" href="./ic.css" />
|
||
|
<title>Module mod_headers</title>
|
||
|
</head>
|
||
|
<body id="rzaiemod_headers"><a name="rzaiemod_headers"><!-- --></a>
|
||
|
<!-- Java sync-link --><script language="Javascript" src="../rzahg/synch.js" type="text/javascript"></script>
|
||
|
<!--Java sync-link--><h1 class="topictitle1">Module mod_headers</h1>
|
||
|
<div><div class="important"><span class="importanttitle">Important:</span> Information
|
||
|
for this topic supports the latest PTF levels for HTTP Server for i5/OS .
|
||
|
It is recommended that you install the latest PTFs to upgrade to the latest
|
||
|
level of the HTTP Server for i5/OS. Some of the topics documented here are
|
||
|
not available prior to this update. See <a href="http://www-03.ibm.com/servers/eserver/iseries/software/http/services/service.html" target="_blank">http://www.ibm.com/servers/eserver/iseries/software/http/services/service.htm</a> <img src="www.gif" alt="Link outside Information Center" /> for more information. </div>
|
||
|
<p><strong>Summary</strong></p>
|
||
|
<p>The headers module allows for the customization of HTTP request and response
|
||
|
headers. The module allows headers to be merged, replaced or removed.</p>
|
||
|
<p><strong>Directives</strong></p>
|
||
|
<ul><li><a href="#header">Header</a></li>
|
||
|
<li><a href="#requestheader">RequestHeader</a></li>
|
||
|
</ul>
|
||
|
</div>
|
||
|
<div class="hr" id="header"><a name="header"><!-- --></a><h2 class="topictitle2">Header</h2>
|
||
|
<div>
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="void" border="0" rules="none"><tbody><tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Module">Module</a></strong>: mod_headers </td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Syntax">Syntax</a></strong>: Header [condition] set|append|add <em>header
|
||
|
value [env=[!]variable]</em></td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Default">Default</a></strong>: none </td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Context">Context</a></strong>: <span id="header__header_context"><a name="header__header_context"><!-- --></a>server config,
|
||
|
virtual host, directory, .htaccess </span></td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Override">Override</a></strong>: FileInfo </td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Origin">Origin</a></strong>: <span id="header__header_origin"><a name="header__header_origin"><!-- --></a>Apache </span></td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: Header append Author "John P. Doe" </td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: Header unset Author</td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: Header echo ^TS*</td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: Header echo Host</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<p>The Header directive can replace, merge or remove HTTP response headers.
|
||
|
The action performed by this module is determined by the action parameter.
|
||
|
This parameter is followed by a header name, which can include the final colon,
|
||
|
but it is not required. Case is also ignored. For add, append, and set, a
|
||
|
value is given as the next parameter. If this value contains spaces, it should
|
||
|
be surrounded by double quotes. For "unset", no value should be given.</p>
|
||
|
<p><strong>Note:</strong>The [condition] parameter was introduced with Apache 2.0.52.
|
||
|
It did not exist prior to this version on iSeries™.</p>
|
||
|
<p><strong>Order of Processing </strong></p>
|
||
|
<p>The Header directive can occur almost anywhere within the server configuration.
|
||
|
It is valid in the main server config and virtual host contexts, inside <Directory>, <Location>,
|
||
|
and <Files> contexts and within .htaccess files.</p>
|
||
|
<p>The Header directives are processed in the following order:</p>
|
||
|
<ol><li>main server</li>
|
||
|
<li>virtual host</li>
|
||
|
<li><Directory> sections and .htaccess</li>
|
||
|
<li><Location></li>
|
||
|
<li><Files></li>
|
||
|
</ol>
|
||
|
<p>Order is important. These two headers have a different effect if reversed.
|
||
|
For example: </p>
|
||
|
<pre class="block">Header append Author "John P. Doe"
|
||
|
Header unset Author</pre>
|
||
|
<p>This way the Author header is not set. If reversed, the Author header is
|
||
|
set to "John P. Doe". The Header directives are processed just before the
|
||
|
response is sent by its handler. This means that some headers, that are added
|
||
|
just before the response is sent, cannot be changed or overridden. This includes
|
||
|
headers such as Date and Server. </p>
|
||
|
<dl class="block"><dt class="dlterm"><strong>Parameter One</strong>: <em>condition</em></dt>
|
||
|
<dd><ul><li>The condition parameter is an optional parameter which can be one of the
|
||
|
following values:
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" width="29.64824120603015%" id="d0e162">Condition</th>
|
||
|
<th valign="top" width="70.35175879396985%" id="d0e164">Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td valign="top" width="29.64824120603015%" headers="d0e162 ">onsuccess</td>
|
||
|
<td valign="top" width="70.35175879396985%" headers="d0e164 ">The Header directive will only effect responses with
|
||
|
a status code of 2xx.</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="29.64824120603015%" headers="d0e162 ">always</td>
|
||
|
<td valign="top" width="70.35175879396985%" headers="d0e164 ">The Header directive will effect all responses, including
|
||
|
2xx.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="block"><dt class="dlterm"><strong>Parameter Two</strong>: <em>action</em></dt>
|
||
|
<dd><ul><li>The action parameter can be one of the following values:
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" width="29.64824120603015%" id="d0e196">Action</th>
|
||
|
<th valign="top" width="70.35175879396985%" id="d0e198">Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td valign="top" width="29.64824120603015%" headers="d0e196 ">set </td>
|
||
|
<td valign="top" width="70.35175879396985%" headers="d0e198 ">The response header is set, replacing any previous header
|
||
|
with this name. </td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="29.64824120603015%" headers="d0e196 ">append </td>
|
||
|
<td valign="top" width="70.35175879396985%" headers="d0e198 ">The response header is appended to any existing header
|
||
|
of the same name. When a new value is merged onto an existing header it is
|
||
|
separated from the existing header with a comma. This is the HTTP standard
|
||
|
way of giving a header multiple values. </td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="29.64824120603015%" headers="d0e196 ">add </td>
|
||
|
<td valign="top" width="70.35175879396985%" headers="d0e198 ">The response header is added to the existing set of
|
||
|
headers, even if this header already exists. This can result in two (or more)
|
||
|
headers having the same name. This can lead to unforeseen consequence, and
|
||
|
in general, "append" should be used instead. </td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="29.64824120603015%" headers="d0e196 ">unset </td>
|
||
|
<td valign="top" width="70.35175879396985%" headers="d0e198 ">The response header of this name is removed, if it exists.
|
||
|
If there are multiple headers of the same name, all will be removed. </td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="29.64824120603015%" headers="d0e196 ">echo</td>
|
||
|
<td valign="top" width="70.35175879396985%" headers="d0e198 ">Request headers with this name are echoed back in the
|
||
|
response headers. <em>Header</em> may be a regular expression. Echo without
|
||
|
any parameters echoes back all the request headers in the response.</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="block"><dt class="dlterm"><strong>Parameter Three</strong>: <em>header </em></dt>
|
||
|
<dd><ul><li>The HTTP Response <em>header</em> parameter to be set, appended, or unset
|
||
|
with this directive. There is no validity checking of the header, which allows
|
||
|
the use of experimental headers.</li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="block"><dt class="dlterm"><strong>Parameter Four</strong>: <em>value </em></dt>
|
||
|
<dd><ul><li>The <em>value</em> parameter may be a character string, a string containing
|
||
|
format specifiers or a combination of both and specifies the value of the
|
||
|
header to be set. It is only valid for set, add and append. There is no validity
|
||
|
checking of the value specified, which allows the use of experimental headers
|
||
|
values. All characters and escaped characters, such as '\n', are allowed in
|
||
|
the value string. If <em>value</em> contains spaces, it should be surrounded
|
||
|
by double quotes. The following format specifiers are supported in value: <dl><dt class="dlterm">%t</dt>
|
||
|
<dd>The time the request was received in Universal Coordinated Time since
|
||
|
the epoch (Jan. 1, 1970) measured in microseconds. The value is preceded by
|
||
|
"t=". </dd>
|
||
|
</dl>
|
||
|
<dl><dt class="dlterm">%D</dt>
|
||
|
<dd>The time from when the request was received to the time the headers are
|
||
|
sent on the wire. This is a measure of the duration of the request. The value
|
||
|
is preceded by "D=". </dd>
|
||
|
</dl>
|
||
|
<dl><dt class="dlterm">%{ENVVAR}e</dt>
|
||
|
<dd>The contents of the environment variable ENVVAR. </dd>
|
||
|
</dl>
|
||
|
<p>Other format strings, such as %s, will receive an error
|
||
|
and the server will not start. </p>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="block"><dt class="dlterm"><strong>Parameter Five</strong>: <em>env=[!]environment-variable</em></dt>
|
||
|
<dd><ul><li>Optional: The envvar parameter specified in the env=[!]envvar clause can
|
||
|
be any character or numeric value. When the Header directive is used with
|
||
|
the add, append, or set argument, a fourth argument may be used to specify
|
||
|
conditions under which the action will be taken. If the environment variable
|
||
|
specified in the env=... argument exists (or if the environment variable does
|
||
|
not exist and env=!... is specified) then the action specified by the Header
|
||
|
directive will take effect. Otherwise, the directive will have no effect on
|
||
|
the request. See the environment variable directives for details on naming
|
||
|
environment variables. </li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<p>The Header directives are processed just before the response is sent to
|
||
|
the network. This means that it is possible to set or override most headers,
|
||
|
except for those headers added by the header filter. </p>
|
||
|
</div>
|
||
|
</div>
|
||
|
<div class="hr" id="requestheader"><a name="requestheader"><!-- --></a><h2 class="topictitle2">RequestHeader</h2>
|
||
|
<div>
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="void" border="0" rules="none"><tbody><tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Module">Module</a></strong>: mod_headers </td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Syntax">Syntax</a></strong>: RequestHeader <em>action header value</em></td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Default">Default</a></strong>: none </td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Context">Context</a></strong>: <span id="requestheader__requestheader_context"><a name="requestheader__requestheader_context"><!-- --></a>server config,
|
||
|
virtual host, directory, .htaccess </span></td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Override">Override</a></strong>: none </td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Origin">Origin</a></strong>: <span id="requestheader__requestheader_origin"><a name="requestheader__requestheader_origin"><!-- --></a>Apache </span></td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: RequestHeader set Accept-Encoding "gzip </td>
|
||
|
</tr>
|
||
|
<tr><td colspan="2" valign="top"><strong><a href="rzaiedirective-dict.htm#rzaiedirective-dict__Example">Example</a></strong>: RequestHeader unset Referer</td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
<p>The RequestHeader directive can replace, merge or remove HTTP request headers.
|
||
|
The header is modified just before the content handler is run, allowing incoming
|
||
|
headers to be modified. The action it performs is determined by the first
|
||
|
argument.</p>
|
||
|
<p>This argument is followed by a header name, which can include the final
|
||
|
colon, but it is not required. Case is ignored. For add, append, and set,
|
||
|
a value is given as the third argument. If this value contains spaces, it
|
||
|
should be surrounded by double quotes. For unset, no value should be given. </p>
|
||
|
<p><strong>Order of Processing</strong></p>
|
||
|
<p>The RequestHeader (and Header) directives can occur almost anywhere within
|
||
|
the server configuration. It is valid in the main server config and virtual
|
||
|
host sections, inside <Directory>, <Location>, and <Files> sections,
|
||
|
and whithin .htaccess files.</p>
|
||
|
<p>The RequestHeader directives are processed in the following order: </p>
|
||
|
<ol><li>main server</li>
|
||
|
<li>virtual host</li>
|
||
|
<li><Directory> sections and .htaccess</li>
|
||
|
<li><Location></li>
|
||
|
<li><Files></li>
|
||
|
</ol>
|
||
|
<p>Order is important. These two headers have a different effect if reversed: </p>
|
||
|
<pre class="block">RequestHeader append MirrorID "mirror 12"
|
||
|
RequestHeader unset MirrorID</pre>
|
||
|
<p>This way round, the MirrorID header is not set. If reversed, the MirrorID
|
||
|
header is set to "mirror 12". </p>
|
||
|
<p>The RequestHeader directive is processed just before the request is run
|
||
|
by its handler in the fixup phase. This should allow headers generated by
|
||
|
the browser, or by Apache input filters to be overridden or modified. For
|
||
|
example,</p>
|
||
|
<pre class="block">RequestHeader append MirrorID "mirror 12"</pre>
|
||
|
<dl class="block"><dt class="dlterm"><strong>Parameter One</strong>: <em>action</em></dt>
|
||
|
<dd><ul><li>The action parameter can be one of the following values:
|
||
|
<div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" frame="border" border="1" rules="all"><thead align="left"><tr><th valign="top" width="29.145728643216078%" id="d0e410">Action</th>
|
||
|
<th valign="top" width="70.85427135678391%" id="d0e412">Description</th>
|
||
|
</tr>
|
||
|
</thead>
|
||
|
<tbody><tr><td valign="top" width="29.145728643216078%" headers="d0e410 ">set </td>
|
||
|
<td valign="top" width="70.85427135678391%" headers="d0e412 ">The request header is set, replacing any previous header
|
||
|
with this name.</td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="29.145728643216078%" headers="d0e410 ">append </td>
|
||
|
<td valign="top" width="70.85427135678391%" headers="d0e412 ">The request header is appended to any existing header
|
||
|
of the same name. When a new value is merged into an existing header, it is
|
||
|
separated from the existing header with a comma. This is the HTTP standard
|
||
|
way of giving a header multiple values. </td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="29.145728643216078%" headers="d0e410 ">add </td>
|
||
|
<td valign="top" width="70.85427135678391%" headers="d0e412 ">The request header is added to the existing set of headers,
|
||
|
even if this header already exists. This can result in two (or more) headers
|
||
|
having the same name. This can lead to unforeseen consequences, and in general <strong>append</strong> should
|
||
|
be used instead. </td>
|
||
|
</tr>
|
||
|
<tr><td valign="top" width="29.145728643216078%" headers="d0e410 ">unset </td>
|
||
|
<td valign="top" width="70.85427135678391%" headers="d0e412 ">The request header of this name is removed, if it exists.
|
||
|
If there are multiple headers of the same name, all will be removed. </td>
|
||
|
</tr>
|
||
|
</tbody>
|
||
|
</table>
|
||
|
</div>
|
||
|
</li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="block"><dt class="dlterm"><strong>Parameter Two</strong>: <em>header </em></dt>
|
||
|
<dd><ul><li>The HTTP Response <em>header</em> parameter to be set, appended, or unset
|
||
|
with this directive. There is no validity checking of the header, which allows
|
||
|
the use of experimental headers. </li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
<dl class="block"><dt class="dlterm"><strong>Parameter Three</strong>: <em>value</em></dt>
|
||
|
<dd><ul><li>The <em>value</em> parameter can have any valid character string as a value
|
||
|
and specifies the value of the header to be set. It is only valid for set,
|
||
|
add and append. There is no validity checking of the value specified, which
|
||
|
allows the use of experimental headers values. All characters and escaped
|
||
|
characters are allowed in this string. If this value contains spaces, it should
|
||
|
be surrounded by double quotes. </li>
|
||
|
</ul>
|
||
|
</dd>
|
||
|
</dl>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
</body>
|
||
|
</html>
|