mod_headers.html revision 1997e02bed99bd0c081962ade257a0ea12ebe15b
c313914d0e66b20969215e519bbf2ab4ecf39512Tinderbox User<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
d77cb075aae5595e460e3299bfc1e8ea5d42b560Evan Hunt<!-- Background white, links blue (unvisited), navy (visited), red (active) -->
30ca20f720ad0887772a79e7abb25b4fa0e4b5b0Mark Andrews BGCOLOR="#FFFFFF"
30ca20f720ad0887772a79e7abb25b4fa0e4b5b0Mark Andrews TEXT="#000000"
30ca20f720ad0887772a79e7abb25b4fa0e4b5b0Mark Andrews LINK="#0000FF"
30ca20f720ad0887772a79e7abb25b4fa0e4b5b0Mark Andrews VLINK="#000080"
701a93f5a592e4652343e049aa495d409c3ee133Mark Andrews ALINK="#FF0000"
701a93f5a592e4652343e049aa495d409c3ee133Mark Andrews<!--#include virtual="header.html" -->
002f1373374a0b72fc0329baa682917929bef168Tony Finch<p>This module provides for the customization of HTTP
8f1ed05dc0aae7ae6c3da6ec6d405df61257a61eMark Andrewsresponse headers.</p>
d8351dfc9b725b0d727be7acab6247d7d501d9a0Mark AndrewsHREF="module-dict.html#SourceFile"
d8351dfc9b725b0d727be7acab6247d7d501d9a0Mark Andrews><STRONG>Source File:</STRONG></A> mod_headers.c
5c78f1f50e53d8e2ed51a187efc2c9a0f43b4b1bMark AndrewsHREF="module-dict.html#ModuleIdentifier"
f1740da065d4555039fe8bb53beb4153e3f94de3Mark Andrews><STRONG>Module Identifier:</STRONG></A> headers_module
31c7ab4fb3f7710af87dc9c3d64c5daf9a3dea35Mark AndrewsHREF="module-dict.html#Compatibility"
31c7ab4fb3f7710af87dc9c3d64c5daf9a3dea35Mark Andrews><STRONG>Compatibility:</STRONG></A> Available in Apache 1.2 and later.
635e4351b04fd61ca6d853bdac6268c090b55129Mark AndrewsThis module provides a directive to control the sending of HTTP
fc04365d2f83f197c8a54545dd9cd4ce6a209940Mark Andrewsheaders. Headers can be merged, replaced or removed.
6fb3db01acad7f5c1f4e23789fb0f2ce56cc07deMukund Sivaraman><STRONG>Syntax:</STRONG></A> Header set|append|add
fd82c70695888c134287b8018296028c252d100eMukund Sivaraman><STRONG>Syntax:</STRONG></A> Header unset <EM>header</EM><BR>
4a53e3c2b83c476a93148eaee0272649beb221caMark Andrews><STRONG>Context:</STRONG></A> server config, virtual host, access.conf,
2cf0fe3b8092f64f8f68ae3693fe2e73e90ad1a4Mark Andrews .htaccess<BR>
e526027287b849f0b6ab6e069156697cbafa22c1Michał KępieńThis directive can replace, merge or remove HTTP response headers. The
e526027287b849f0b6ab6e069156697cbafa22c1Michał Kępieńaction it performs is determined by the first argument. This can be one
e526027287b849f0b6ab6e069156697cbafa22c1Michał Kępieńof the following values:
7e1a62eea2e4ba9d6c3fc718e679b965fa514f69Mark Andrews The response header is set, replacing any previous header with this name
afefd754734f896bf3e0590177fff83e7cdfdf35Mark Andrews The response header is appended to any existing header of the same
afefd754734f896bf3e0590177fff83e7cdfdf35Mark Andrews name. When a new value is merged onto an existing header it is
afefd754734f896bf3e0590177fff83e7cdfdf35Mark Andrews separated from the existing header with a comma. This is the HTTP standard
f0353a586c2bfbae999193cb644b6bc94c7944d8Mark Andrews way of giving a header multiple values.
7ff28f5befbee76048a23e504dcd3f9a44ce6209Evan Hunt The response header is added to the existing set of headers, even if
7ff28f5befbee76048a23e504dcd3f9a44ce6209Evan Hunt this header already exists. This can result in two (or more) headers
7ff28f5befbee76048a23e504dcd3f9a44ce6209Evan Hunt having the same name. This can lead to unforeseen consequences, and in
7ff28f5befbee76048a23e504dcd3f9a44ce6209Evan Hunt general "append" should be used instead.
7ff28f5befbee76048a23e504dcd3f9a44ce6209Evan Hunt The response header of this name is removed, if it exists. If there are
7ff28f5befbee76048a23e504dcd3f9a44ce6209Evan Hunt multiple headers of the same name, all will be removed.
cad79077bd5b2616bc4a7a6b3cbc0953bef8917fMark AndrewsThis argument is followed by a header name, which can include the
cad79077bd5b2616bc4a7a6b3cbc0953bef8917fMark Andrewsfinal colon, but it is not required. Case is ignored. For
cad79077bd5b2616bc4a7a6b3cbc0953bef8917fMark Andrewsadd, append and set a value is given as the third argument. If this
adfe58e8e5cd1890585e92b67f1fd01989a1fa7dMark Andrewsvalue contains spaces, it should be surrounded by double quotes.
adfe58e8e5cd1890585e92b67f1fd01989a1fa7dMark AndrewsFor unset, no value should be given.
c3237dec879f82855403ff7e3ba87b298172efd5Mark AndrewsThe Header directive can occur almost anywhere within the server
c3237dec879f82855403ff7e3ba87b298172efd5Mark Andrewsconfiguration. It is valid in the main server config and virtual host
c3237dec879f82855403ff7e3ba87b298172efd5Mark Andrewssections, inside <Directory>, <Location> and <Files>
cb616c6d5c2ece1fac37fa6e0bca2b53d4043098Mark Andrewssections, and within .htaccess files.
cb616c6d5c2ece1fac37fa6e0bca2b53d4043098Mark AndrewsThe Header directives are processed in the following order:
c0a2210466dec0cc81ebf2ffbe21693b57b9c29cMark Andrews<LI>main server
c0a2210466dec0cc81ebf2ffbe21693b57b9c29cMark Andrews<LI>virtual host
534057c9f91a3eb6e0541f3526459c716239b337Mark Andrews<LI><Directory> sections and .htaccess
534057c9f91a3eb6e0541f3526459c716239b337Mark Andrews<LI><Location>
534057c9f91a3eb6e0541f3526459c716239b337Mark Andrews<LI><Files>
0f14b041328c062b1fa391887376388dfc8b2fe5Mark AndrewsOrder is important. These two headers have a different effect if reversed:
f7f4730e563a2749629fe7fef4cd9513cd2bfab7Mark AndrewsHeader append Author "John P. Doe"
f7f4730e563a2749629fe7fef4cd9513cd2bfab7Mark AndrewsHeader unset Author
2d82ed9456e72dc4373bea19d63411afe1c48962Mark AndrewsThis way round, the Author header is not set. If reversed, the Author
2d82ed9456e72dc4373bea19d63411afe1c48962Mark Andrewsheader is set to "John P. Doe".
a5a1cbece45e6ca68aafe3b9b995eac6b0f45dd2Mark AndrewsThe Header directives are processed just before the response is sent
0d6328ce5f6b799f8e7c6cbbb3b965cf29bfb7baMark Andrewsby its handler. These means that some headers that are added just
0d6328ce5f6b799f8e7c6cbbb3b965cf29bfb7baMark Andrewsbefore the response is sent cannot be unset or overridden. This
0d6328ce5f6b799f8e7c6cbbb3b965cf29bfb7baMark Andrewsincludes headers such as "Date" and "Server".
677f507de7c546c187c1505c48bc7b440545485cMark Andrews<!--#include virtual="footer.html" -->