summaryrefslogtreecommitdiffstats
path: root/docs/manual/mod/mod_headers.xml
diff options
context:
space:
mode:
authorLuca Toscano <elukey@apache.org>2016-11-15 23:57:18 +0100
committerLuca Toscano <elukey@apache.org>2016-11-15 23:57:18 +0100
commitfb6ed036831645ce8a083e87f691c044c8c782a1 (patch)
tree022386db8a249d6b9ce4fc05d3f7ad9e05642a7f /docs/manual/mod/mod_headers.xml
parentdocumentation rebuild (diff)
downloadapache2-fb6ed036831645ce8a083e87f691c044c8c782a1.tar.xz
apache2-fb6ed036831645ce8a083e87f691c044c8c782a1.zip
Added a note in the mod_headers docs about Content-Type and setifempty
This note has been added as a follow up of a stack overflow post (thanks to Michael Allan for the research): http://stackoverflow.com/questions/29398123/apache-2-4-set-mime-type-of-file-without-extension After a chat in #httpd-dev it seems that the issue boils down to how %{CONTENT_TYPE} is evaluated in util_expr_eval.c (r->content_type) vs how setifempty is (only a check of the response headers). This particular behavior might be a bug or feature, but it is worth to alert our users. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1769899 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--docs/manual/mod/mod_headers.xml13
1 files changed, 11 insertions, 2 deletions
diff --git a/docs/manual/mod/mod_headers.xml b/docs/manual/mod/mod_headers.xml
index 476d94098d..143214d035 100644
--- a/docs/manual/mod/mod_headers.xml
+++ b/docs/manual/mod/mod_headers.xml
@@ -410,8 +410,17 @@ available in 2.4.10 and later</compatibility>
<dt><code>setifempty</code></dt>
<dd>The request header is set, but only if there is no previous header
- with this name.<br />
- Available in 2.4.7 and later.</dd>
+ with this name.
+ <note>
+ The Content-Type header is a special use case since there might be
+ the chance that its value have been determined but the header is not part
+ of the response when <code>setifempty</code> is evaluated.
+ It is safer to use <code>set</code> for this use case like in the
+ following example:
+ <highlight language="config">
+ Header set Content-Type "text/plain" "expr=-z %{CONTENT_TYPE}"
+ </highlight>
+ </note></dd>
<dt><code>unset</code></dt>
<dd>The response header of this name is removed, if it exists.