Apache HTTP Server Version 1.3
Module mod_headers
This module provides for the customization of HTTP response
headers.
Status: Extension
Source File:
mod_headers.c
Module Identifier:
headers_module
Compatibility: Available in
Apache 1.2 and later.
Summary
This module provides a directive to control the sending of HTTP
headers. Headers can be merged, replaced or removed.
Directives
directive
Syntax: Header set|append|add
header value
Syntax: Header unset
header
Context: server config, virtual
host, access.conf, .htaccess
Override: FileInfo
Status: Extension
Module: mod_headers
This directive can replace, merge or remove HTTP response
headers during 1xx and 2xx series replies. For 3xx, 4xx and 5xx
use the ErrorHeader directive.
The action it performs is determined by the first
argument. This can be one of the following values:
- set
The response header is set, replacing any previous header
with this name
- append
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.
- add
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 consequences, and in general "append" should be
used instead.
- unset
The response header of this name is removed, if it exists.
If there are multiple headers of the same name, all will be
removed.
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.
Order of Processing
The Header directive 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 within
.htaccess files.
The Header directives are processed in the following
order:
- main server
- virtual host
- <Directory> sections and .htaccess
- <Location>
- <Files>
Order is important. These two headers have a different effect
if reversed:
Header append Author "John P. Doe"
Header unset Author
This way round, 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. These means that some headers that are
added just before the response is sent cannot be unset or
overridden. This includes headers such as "Date" and
"Server".
directive
Syntax: ErrorHeader set|append|add
header value
Syntax: ErrorHeader unset
header
Context: server config, virtual
host, access.conf, .htaccess
Override: FileInfo
Status: Extension
Module: mod_headers
This directive can replace, merge or remove HTTP response
headers during 3xx, 4xx and 5xx replies. For normal replies
use the Header directive.
This directive is identical to the Header
directive in all other respects. Consult this directive for
more information on the syntax.
directive
Syntax: RequestHeader set|append|add
header value
Syntax: RequestHeader unset
header
Context: server config, virtual
host, access.conf, .htaccess
Override: FileInfo
Status: Extension
Module: mod_headers
This directive can replace, merge or remove HTTP request
headers. As opposed to the Header directive,
this directive modifies incoming request headers instead of outgoing
responses.
This directive is identical to the Header
directive in all other respects. Consult this directive for
more information on the syntax.
Apache HTTP Server Version 1.3