summaryrefslogtreecommitdiff
path: root/usr.sbin/httpd/htdocs/manual/mod/mod_headers.html
blob: c2984d99dabdb78cccb96ebdf298766f01719c6d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta name="generator" content="HTML Tidy, see www.w3.org" />

    <title>Apache module mod_headers</title>
  </head>
  <!-- Background white, links blue (unvisited), navy (visited), red (active) -->

  <body bgcolor="#FFFFFF" text="#000000" link="#0000FF"
  vlink="#000080" alink="#FF0000">
        <div align="CENTER">
      <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" /> 

      <h3>Apache HTTP Server Version 1.3</h3>
    </div>


    <h1 align="CENTER">Module mod_headers</h1>

    <p>This module provides for the customization of HTTP response
    headers.</p>

    <p><a href="module-dict.html#Status"
    rel="Help"><strong>Status:</strong></a> Extension<br />
     <a href="module-dict.html#SourceFile"
    rel="Help"><strong>Source File:</strong></a>
    mod_headers.c<br />
     <a href="module-dict.html#ModuleIdentifier"
    rel="Help"><strong>Module Identifier:</strong></a>
    headers_module<br />
     <a href="module-dict.html#Compatibility"
    rel="Help"><strong>Compatibility:</strong></a> Available in
    Apache 1.2 and later.</p>

    <h2>Summary</h2>
    This module provides a directive to control the sending of HTTP
    headers. Headers can be merged, replaced or removed. 

    <h2>Directives</h2>

    <ul>
      <li><a href="#header">Header</a></li>
      <li><a href="#errorheader">ErrorHeader</a></li>
    </ul>
    <hr />

    <h2><a id="header" name="header">Header</a> directive</h2>
    <a href="directive-dict.html#Syntax"
    rel="Help"><strong>Syntax:</strong></a> Header set|append|add
    <em>header</em> <em>value</em><br />
     <a href="directive-dict.html#Syntax"
    rel="Help"><strong>Syntax:</strong></a> Header unset
    <em>header</em><br />
     <a href="directive-dict.html#Context"
    rel="Help"><strong>Context:</strong></a> server config, virtual
    host, access.conf, .htaccess<br />
     <a href="directive-dict.html#Override"
    rel="Help"><strong>Override:</strong></a> FileInfo<br />
     <a href="directive-dict.html#Status"
    rel="Help"><strong>Status:</strong></a> Extension<br />
     <a href="directive-dict.html#Module"
    rel="Help"><strong>Module:</strong></a> mod_headers 

    <p>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.
    </p>
     <p>
     The action it performs is determined by the first
    argument. This can be one of the following values:</p>

    <ul>
      <li><strong>set</strong><br />
       The response header is set, replacing any previous header
      with this name</li>

      <li><strong>append</strong><br />
       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.</li>

      <li><strong>add</strong><br />
       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.</li>

      <li><strong>unset</strong><br />
       The response header of this name is removed, if it exists.
      If there are multiple headers of the same name, all will be
      removed.</li>
    </ul>
    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. 

    <h3>Order of Processing</h3>
    The Header directive can occur almost anywhere within the
    server configuration. It is valid in the main server config and
    virtual host sections, inside &lt;Directory&gt;,
    &lt;Location&gt; and &lt;Files&gt; sections, and within
    .htaccess files. 

    <p>The Header directives are processed in the following
    order:</p>

    <ol>
      <li>main server</li>

      <li>virtual host</li>

      <li>&lt;Directory&gt; sections and .htaccess</li>

      <li>&lt;Location&gt;</li>

      <li>&lt;Files&gt;</li>
    </ol>
    Order is important. These two headers have a different effect
    if reversed: 
<pre>
Header append Author "John P. Doe"
Header unset Author
</pre>
    This way round, the Author header is not set. If reversed, the
    Author header is set to "John P. Doe". 

    <p>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".</p>

    <h2><a id="errorheader" name="errorheader">ErrorHeader</a> directive</h2>
    <a href="directive-dict.html#Syntax"
    rel="Help"><strong>Syntax:</strong></a> ErrorHeader set|append|add
    <em>header</em> <em>value</em><br />
     <a href="directive-dict.html#Syntax"
    rel="Help"><strong>Syntax:</strong></a> ErrorHeader unset
    <em>header</em><br />
     <a href="directive-dict.html#Context"
    rel="Help"><strong>Context:</strong></a> server config, virtual
    host, access.conf, .htaccess<br />
     <a href="directive-dict.html#Override"
    rel="Help"><strong>Override:</strong></a> FileInfo<br />
     <a href="directive-dict.html#Status"
    rel="Help"><strong>Status:</strong></a> Extension<br />
     <a href="directive-dict.html#Module"
    rel="Help"><strong>Module:</strong></a> mod_headers 

    <p>This directive can replace, merge or remove HTTP response
    headers during 3xx, 4xx and 5xx replies. For normal replies
    use the Header directive.
    </p>
    <p>This directive is identical to the <a href="#header">Header</a> 
    directive in all other respects. Consult this directive for
    more information on the syntax.
    </P>

    <p>    <hr />

    <h3 align="CENTER">Apache HTTP Server Version 1.3</h3>
    <a href="./"><img src="../images/index.gif" alt="Index" /></a>
    <a href="../"><img src="../images/home.gif" alt="Home" /></a>

    </p>
  </body>
</html>