mod_headers.html.en revision ec085e7a34ecb79427d8f6ad3ab7259fe9f00040
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<?xml version="1.0" encoding="ISO-8859-1"?>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head><!--
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce This file is generated from xml source: DO NOT EDIT
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce -->
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<title>mod_headers - Apache HTTP Server</title>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<link href="/style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<link href="/style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<link href="/style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" />
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<link href="/images/favicon.ico" rel="shortcut icon" /></head>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<body>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div id="page-header">
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<p class="apache">Apache HTTP Server Version 2.1</p>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<img alt="" src="/images/feather.gif" /></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div class="up"><a href="./"><img title="&lt;-" alt="&lt;-" src="/images/left.gif" /></a></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div id="path">
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<a href="http://www.apache.org/">Apache</a> &gt; <a href="http://httpd.apache.org/">HTTP Server</a> &gt; <a href="http://httpd.apache.org/docs-project/">Documentation</a> &gt; <a href="../">Version 2.1</a> &gt; <a href="./">Modules</a></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div id="page-content">
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<div id="preamble"><h1>Apache Module mod_headers</h1>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div class="toplang">
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<p><span>Available Languages: </span><a href="/en/mod/mod_headers.html" title="English">&nbsp;en&nbsp;</a> |
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<a href="/ja/mod/mod_headers.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce</div>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>Customization of HTTP request and response
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozekheaders</td></tr>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<tr><th><a href="module-dict.html#Status">Status:</a></th><td>Extension</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="module-dict.html#ModuleIdentifier">Module�Identifier:</a></th><td>headers_module</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="module-dict.html#SourceFile">Source�File:</a></th><td>mod_headers.c</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="module-dict.html#Compatibility">Compatibility:</a></th><td><code class="directive"><a href="#requestheader">RequestHeader</a></code>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozekis available only in Apache 2.0</td></tr></table>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<h3>Summary</h3>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>This module provides directives to control and modify HTTP
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek request and response headers. Headers can be merged, replaced
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek or removed.</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek</div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div id="quickview"><h3 class="directives">Directives</h3>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<ul id="toc">
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<li><img alt="" src="/images/down.gif" /> <a href="#errorheader">ErrorHeader</a></li>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<li><img alt="" src="/images/down.gif" /> <a href="#header">Header</a></li>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<li><img alt="" src="/images/down.gif" /> <a href="#requestheader">RequestHeader</a></li>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek</ul>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<h3>Topics</h3>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<ul id="topics">
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<li><img alt="" src="/images/down.gif" /> <a href="#order">Order of Processing</a></li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<li><img alt="" src="/images/down.gif" /> <a href="#examples">Examples</a></li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce</ul></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div class="section">
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<h2><a name="order" id="order">Order of Processing</a></h2>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina <p>The directives provided by <code class="module"><a href="/mod/mod_headers.html">mod_headers</a></code> can
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina occur almost anywhere within the server configuration, and can be
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina limited in scope by enclosing them in <a href="/sections.html">configuration sections</a>.</p>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina <p>Order of processing is important and is affected both by the
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina order in the configuration file and by placement in <a href="/sections.html#mergin">configuration sections</a>. These
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina two headers have a different effect if reversed:</p>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <div class="example"><p><code>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek RequestHeader append MirrorID "mirror 12"<br />
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce RequestHeader unset MirrorID
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce </code></p></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <p>This way round, the <code>MirrorID</code> header is not set. If
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce reversed, the MirrorID header is set to "mirror 12".</p>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce</div><div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div class="section">
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<h2><a name="examples" id="examples">Examples</a></h2>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <ol>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce Copy all request headers that begin with "TS" to the
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce response headers:
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <div class="example"><p><code>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce Header echo ^TS
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce </code></p></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce </li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce Add a header, <code>MyHeader</code>, to the response including a
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina timestamp for when the request was received and how long it
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina took to begin serving the request. This header can be used by
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina the client to intuit load on the server or in isolating
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina bottlenecks between the client and the server.
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina <div class="example"><p><code>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina Header add MyHeader "%D %t"
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina </code></p></div>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina <p>results in this header being added to the response:</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <div class="example"><p><code>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina MyHeader: D=3775428 t=991424704447256
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce </code></p></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce </li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce Say hello to Joe
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <div class="example"><p><code>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce Header add MyHeader "Hello Joe. It took %D microseconds \<br />
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek for Apache to serve this request."
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek </code></p></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>results in this header being added to the response:</p>
8e195a545d41647e591c1d06082133cbd25dc0a4Jakub Hrozek
8e195a545d41647e591c1d06082133cbd25dc0a4Jakub Hrozek <div class="example"><p><code>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek MyHeader: Hello Joe. It took D=3775428 microseconds for Apache
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina to serve this request.
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek </code></p></div>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek </li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce Conditionally send <code>MyHeader</code> on the response if and
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce only if header "MyRequestHeader" is present on the request. This
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce is useful for constructing headers in response to some client
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce stimulus. Note that this example requires the services of the
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <code class="module"><a href="/mod/mod_setenvif.html">mod_setenvif</a></code> module.
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina <div class="example"><p><code>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina SetEnvIf MyRequestHeader value HAVE_MyRequestHeader<br />
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina Header add MyHeader "%D %t mytext" env=HAVE_MyRequestHeader<br />
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina </code></p></div>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina <p>If the header <code>MyRequestHeader: value</code> is present on
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina the HTTP request, the response will contain the following header:</p>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <div class="example"><p><code>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina MyHeader: D=3775428 t=991424704447256 mytext
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina </code></p></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce </li>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce </ol>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce</div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<div class="directive-section"><h2><a name="ErrorHeader" id="ErrorHeader">ErrorHeader</a> <a name="errorheader" id="errorheader">Directive</a></h2>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<table class="directive">
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configure HTTP response headers also for error responses</td></tr>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>ErrorHeader set|append|add|unset|echo <var>header</var>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce[<var>value</var> [env=[!]<var>variable</var>]]</code></td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_headers</td></tr>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce</table>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<p>This directive can replace, merge or remove HTTP response headers also during
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<code>3<var>xx</var></code>, <code>4<var>xx</var></code> and
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<code>5<var>xx</var></code> replies. For normal replies use the <code class="directive"><a href="#header">Header</a></code> directive.</p>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce<p>This directive is identical to the <code class="directive"><a href="#header">Header</a></code> directive in all other respects.
225d845476b6136be9b77f528ed986bba7a7f732Simo SorceConsult this directive for more information on the syntax.</p>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce</div>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<div class="directive-section"><h2><a name="Header" id="Header">Header</a> <a name="header" id="header">Directive</a></h2>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<table class="directive">
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configure HTTP response headers</td></tr>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>Header set|append|add|unset|echo <var>header</var>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina[<var>value</var> [env=[!]<var>variable</var>]]</code></td></tr>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_headers</td></tr>
a0d010f488bf15fb3e170ce04092013fa494401fPavel Březina</table>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <p>This directive can replace, merge or remove HTTP response
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce headers. The header is modified just after the content handler
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce and output filters are run, allowing outgoing headers to be
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce modified. The action it performs is determined by the first
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce argument. This can be one of the following values:</p>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <dl>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <dt><code>set</code></dt>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <dd>The response header is set, replacing any previous header
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek with this name. The <var>value</var> may be a format string.</dd>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dt><code>append</code></dt>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <dd>The response header is appended to any existing header of
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce the same name. When a new value is merged onto an existing
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce header it is separated from the existing header with a comma.
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce This is the HTTP standard way of giving a header multiple values.</dd>
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce
225d845476b6136be9b77f528ed986bba7a7f732Simo Sorce <dt><code>add</code></dt>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dd>The response header is added to the existing set of headers,
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek even if this header already exists. This can result in two
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek (or more) headers having the same name. This can lead to
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek unforeseen consequences, and in general "append" should be
115241b0eeedd033d34d9721a896f031140944d7Pavel Březina used instead.</dd>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dt><code>unset</code></dt>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dd>The response header of this name is removed, if it exists.
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek If there are multiple headers of the same name, all will be
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek removed.</dd>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dt><code>echo</code></dt>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dd>Request headers with this name are echoed back in the
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek response headers. <var>header</var> may be a regular expression.</dd>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek </dl>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>This argument is followed by a <var>header</var> name, which
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek can include the final colon, but it is not required. Case is
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek ignored for <code>set</code>, <code>append</code>, <code>add</code>
115241b0eeedd033d34d9721a896f031140944d7Pavel Březina and <code>unset</code>. The <var>header</var> name for <code>echo</code>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek is case sensitive and may be a regular expression.</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>For <code>add</code>, <code>append</code> and <code>set</code> a
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <var>value</var> is specified as the third argument. If <var>value</var>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek contains spaces, it should be surrounded by doublequotes.
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <var>value</var> may be a character string, a string containing format
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek specifiers or a combination of both. The following format specifiers
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek are supported in <var>value</var>:</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <table class="bordered">
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <tr><td><code>%t</code></td>
115241b0eeedd033d34d9721a896f031140944d7Pavel Březina <td>The time the request was received in Universal Coordinated Time
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek since the epoch (Jan. 1, 1970) measured in microseconds. The value
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek is preceded by <code>t=</code>.</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <tr><td><code>%D</code></td>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <td>The time from when the request was received to the time the
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek headers are sent on the wire. This is a measure of the duration
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek of the request. The value is preceded by <code>D=</code>.</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <tr><td><code>%{FOOBAR}e</code></td>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <td>The contents of the <a href="/env.html">environment
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek variable</a> <code>FOOBAR</code>.</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
18f01e63c1968c29bddb9e48c279b583c0444730Jakub Hrozek <tr><td><code>%{FOOBAR}s</code></td>
18f01e63c1968c29bddb9e48c279b583c0444730Jakub Hrozek <td>The contents of the <a href="mod_ssl.html#envvars">SSL environment
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek variable</a> <code>FOOBAR</code>, if <code class="module"><a href="/mod/mod_ssl.html">mod_ssl</a></code> is enabled.</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek </table>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <div class="note"><h3>Note</h3>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>The <code>%s</code> format specifier is only available in
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek Apache 2.1 and later; it can be used instead of <code>%e</code>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek to avoid the overhead of enabling <code>SSLOptions
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek +StdEnvVars</code>. If <code>SSLOptions +StdEnvVars</code> must
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek be enabled anyway for some other reason, <code>%e</code> will be
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek more efficient than <code>%s</code>.</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek </div>
115241b0eeedd033d34d9721a896f031140944d7Pavel Březina
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>When the <code class="directive">Header</code> directive is used with the
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <code>add</code>, <code>append</code>, or <code>set</code>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek argument, a fourth argument may be used to specify conditions
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek under which the action will be taken. If the <a href="/env.html">environment variable</a> specified in the
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <code>env=...</code> argument exists (or if the environment
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek variable does not exist and <code>env=!...</code> is specified)
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek then the action specified by the <code class="directive">Header</code> directive
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek will take effect. Otherwise, the directive will have no effect
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek on the request.</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>The <code class="directive">Header</code> directives are processed just
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek before the response is sent to the network. These means that it is
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek possible to set and/or override most headers, except for those headers
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek added by the header filter.</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek</div>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<div class="top"><a href="#page-header"><img alt="top" src="/images/up.gif" /></a></div>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<div class="directive-section"><h2><a name="RequestHeader" id="RequestHeader">RequestHeader</a> <a name="requestheader" id="requestheader">Directive</a></h2>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<table class="directive">
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Description">Description:</a></th><td>Configure HTTP request headers</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Syntax">Syntax:</a></th><td><code>RequestHeader set|append|add|unset <var>header</var>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek[<var>value</var> [env=[!]<var>variable</var>]]</code></td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Context">Context:</a></th><td>server config, virtual host, directory, .htaccess</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Override">Override:</a></th><td>FileInfo</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Status">Status:</a></th><td>Extension</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<tr><th><a href="directive-dict.html#Module">Module:</a></th><td>mod_headers</td></tr>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek</table>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>This directive can replace, merge or remove HTTP request
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek headers. The header is modified just before the content handler
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek is run, allowing incoming headers to be modified. The action it
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek performs is determined by the first argument. This can be one
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek of the following values:</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
4c08db0fb0dda3d27b1184248ca5c800d7ce23f0Michal Zidek <dl>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dt><code>set</code></dt>
115241b0eeedd033d34d9721a896f031140944d7Pavel Březina <dd>The request header is set, replacing any previous header
115241b0eeedd033d34d9721a896f031140944d7Pavel Březina with this name</dd>
115241b0eeedd033d34d9721a896f031140944d7Pavel Březina
115241b0eeedd033d34d9721a896f031140944d7Pavel Březina <dt><code>append</code></dt>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dd>The request header is appended to any existing header of the
a4bf85ccc902490c3b75b44532010fbb32169801Lukas Slebodnik same name. When a new value is merged onto an existing header
18f01e63c1968c29bddb9e48c279b583c0444730Jakub Hrozek it is separated from the existing header with a comma. This
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek is the HTTP standard way of giving a header multiple
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek values.</dd>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dt><code>add</code></dt>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dd>The request header is added to the existing set of headers,
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek even if this header already exists. This can result in two
18f01e63c1968c29bddb9e48c279b583c0444730Jakub Hrozek (or more) headers having the same name. This can lead to
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek unforeseen consequences, and in general <code>append</code> should be
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek used instead.</dd>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dt><code>unset</code></dt>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <dd>The request header of this name is removed, if it exists. If
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek there are multiple headers of the same name, all will be removed.</dd>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek </dl>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>This argument is followed by a header name, which can
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek include the final colon, but it is not required. Case is
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek ignored. For <code>add</code>, <code>append</code> and
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <code>set</code> a <var>value</var> is given as the third argument. If
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <var>value</var> contains spaces, it should be surrounded by double
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek quotes. For unset, no <var>value</var> should be given.</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>When the <code class="directive">RequestHeader</code> directive is used with the
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <code>add</code>, <code>append</code>, or <code>set</code> argument, a
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek fourth argument may be used to specify conditions under which the action
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek will be taken. If the <a href="/env.html">environment variable</a>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek specified in the <code>env=...</code> argument exists (or if the environment
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek variable does not exist and <code>env=!...</code> is specified) then the
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek action specified by the <code class="directive">RequestHeader</code> directive will
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek take effect. Otherwise, the directive will have no effect on the
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek request.</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek <p>The <code class="directive">RequestHeader</code> directive is processed
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek just before the request is run by its handler in the fixup phase.
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek This should allow headers generated by the browser, or by Apache
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek input filters to be overridden or modified.</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek</div>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek</div>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<div class="bottomlang">
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<p><span>Available Languages: </span><a href="/en/mod/mod_headers.html" title="English">&nbsp;en&nbsp;</a> |
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<a href="/ja/mod/mod_headers.html" hreflang="ja" rel="alternate" title="Japanese">&nbsp;ja&nbsp;</a></p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek</div><div id="footer">
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<p class="apache">Copyright 1999-2004 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek<p class="menu"><a href="/mod/">Modules</a> | <a href="/mod/directives.html">Directives</a> | <a href="/faq/">FAQ</a> | <a href="/glossary.html">Glossary</a> | <a href="/sitemap.html">Sitemap</a></p></div>
c0bca1722d6f9dfb654ad78397be70f79ff39af1Jakub Hrozek</body></html>