1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 2 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 3 4<html xmlns="http://www.w3.org/1999/xhtml"> 5 <head> 6 <meta name="generator" content="HTML Tidy, see www.w3.org" /> 7 8 <title>Apache module mod_headers</title> 9 </head> 10 <!-- Background white, links blue (unvisited), navy (visited), red (active) --> 11 12 <body bgcolor="#FFFFFF" text="#000000" link="#0000FF" 13 vlink="#000080" alink="#FF0000"> 14 <div align="CENTER"> 15 <img src="../images/sub.gif" alt="[APACHE DOCUMENTATION]" /> 16 17 <h3>Apache HTTP Server Version 1.3</h3> 18 </div> 19 20 21 <h1 align="CENTER">Module mod_headers</h1> 22 23 <p>This module provides for the customization of HTTP response 24 headers.</p> 25 26 <p><a href="module-dict.html#Status" 27 rel="Help"><strong>Status:</strong></a> Extension<br /> 28 <a href="module-dict.html#SourceFile" 29 rel="Help"><strong>Source File:</strong></a> 30 mod_headers.c<br /> 31 <a href="module-dict.html#ModuleIdentifier" 32 rel="Help"><strong>Module Identifier:</strong></a> 33 headers_module<br /> 34 <a href="module-dict.html#Compatibility" 35 rel="Help"><strong>Compatibility:</strong></a> Available in 36 Apache 1.2 and later.</p> 37 38 <h2>Summary</h2> 39 This module provides a directive to control the sending of HTTP 40 headers. Headers can be merged, replaced or removed. 41 42 <h2>Directives</h2> 43 44 <ul> 45 <li><a href="#header">Header</a></li> 46 <li><a href="#errorheader">ErrorHeader</a></li> 47 </ul> 48 <hr /> 49 50 <h2><a id="header" name="header">Header</a> directive</h2> 51 <a href="directive-dict.html#Syntax" 52 rel="Help"><strong>Syntax:</strong></a> Header set|append|add 53 <em>header</em> <em>value</em><br /> 54 <a href="directive-dict.html#Syntax" 55 rel="Help"><strong>Syntax:</strong></a> Header unset 56 <em>header</em><br /> 57 <a href="directive-dict.html#Context" 58 rel="Help"><strong>Context:</strong></a> server config, virtual 59 host, access.conf, .htaccess<br /> 60 <a href="directive-dict.html#Override" 61 rel="Help"><strong>Override:</strong></a> FileInfo<br /> 62 <a href="directive-dict.html#Status" 63 rel="Help"><strong>Status:</strong></a> Extension<br /> 64 <a href="directive-dict.html#Module" 65 rel="Help"><strong>Module:</strong></a> mod_headers 66 67 <p>This directive can replace, merge or remove HTTP response 68 headers during 1xx and 2xx series replies. For 3xx, 4xx and 5xx 69 use the ErrorHeader directive. 70 </p> 71 <p> 72 The action it performs is determined by the first 73 argument. This can be one of the following values:</p> 74 75 <ul> 76 <li><strong>set</strong><br /> 77 The response header is set, replacing any previous header 78 with this name</li> 79 80 <li><strong>append</strong><br /> 81 The response header is appended to any existing header of 82 the same name. When a new value is merged onto an existing 83 header it is separated from the existing header with a comma. 84 This is the HTTP standard way of giving a header multiple 85 values.</li> 86 87 <li><strong>add</strong><br /> 88 The response header is added to the existing set of headers, 89 even if this header already exists. This can result in two 90 (or more) headers having the same name. This can lead to 91 unforeseen consequences, and in general "append" should be 92 used instead.</li> 93 94 <li><strong>unset</strong><br /> 95 The response header of this name is removed, if it exists. 96 If there are multiple headers of the same name, all will be 97 removed.</li> 98 </ul> 99 This argument is followed by a header name, which can include 100 the final colon, but it is not required. Case is ignored. For 101 add, append and set a value is given as the third argument. If 102 this value contains spaces, it should be surrounded by double 103 quotes. For unset, no value should be given. 104 105 <h3>Order of Processing</h3> 106 The Header directive can occur almost anywhere within the 107 server configuration. It is valid in the main server config and 108 virtual host sections, inside <Directory>, 109 <Location> and <Files> sections, and within 110 .htaccess files. 111 112 <p>The Header directives are processed in the following 113 order:</p> 114 115 <ol> 116 <li>main server</li> 117 118 <li>virtual host</li> 119 120 <li><Directory> sections and .htaccess</li> 121 122 <li><Location></li> 123 124 <li><Files></li> 125 </ol> 126 Order is important. These two headers have a different effect 127 if reversed: 128<pre> 129Header append Author "John P. Doe" 130Header unset Author 131</pre> 132 This way round, the Author header is not set. If reversed, the 133 Author header is set to "John P. Doe". 134 135 <p>The Header directives are processed just before the response 136 is sent by its handler. These means that some headers that are 137 added just before the response is sent cannot be unset or 138 overridden. This includes headers such as "Date" and 139 "Server".</p> 140 141 <h2><a id="errorheader" name="errorheader">ErrorHeader</a> directive</h2> 142 <a href="directive-dict.html#Syntax" 143 rel="Help"><strong>Syntax:</strong></a> ErrorHeader set|append|add 144 <em>header</em> <em>value</em><br /> 145 <a href="directive-dict.html#Syntax" 146 rel="Help"><strong>Syntax:</strong></a> ErrorHeader unset 147 <em>header</em><br /> 148 <a href="directive-dict.html#Context" 149 rel="Help"><strong>Context:</strong></a> server config, virtual 150 host, access.conf, .htaccess<br /> 151 <a href="directive-dict.html#Override" 152 rel="Help"><strong>Override:</strong></a> FileInfo<br /> 153 <a href="directive-dict.html#Status" 154 rel="Help"><strong>Status:</strong></a> Extension<br /> 155 <a href="directive-dict.html#Module" 156 rel="Help"><strong>Module:</strong></a> mod_headers 157 158 <p>This directive can replace, merge or remove HTTP response 159 headers during 3xx, 4xx and 5xx replies. For normal replies 160 use the Header directive. 161 </p> 162 <p>This directive is identical to the <a href="#header">Header</a> 163 directive in all other respects. Consult this directive for 164 more information on the syntax. 165 </P> 166 167 <p> <hr /> 168 169 <h3 align="CENTER">Apache HTTP Server Version 1.3</h3> 170 <a href="./"><img src="../images/index.gif" alt="Index" /></a> 171 <a href="../"><img src="../images/home.gif" alt="Home" /></a> 172 173 </p> 174 </body> 175</html> 176 177