Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to use different apache options if a HTTP header is present.

For example, something like:

<IfHeader "MyHeader">
  SSLOptions +ExportCertData
  SSLVerifyClient optional

The "IfHeader" directive does not exist. Is it possible with SetEnvIf or some other directives?

share|improve this question

Have you tried re-writing the URL internally to a location that you can configure the way you want?

Something like this:

RewriteCond %{HTTP:MyHeader} .+
RewriteRule (.*) $1/special [R,L]

<Location ~ "/special$">
share|improve this answer
It is a nice idea. Is the redirect needed? The configuration may even be done in .htaccess, if using <Files> instead of <Location>. – Ivo Danihelka Dec 4 '10 at 8:48
Hi, Ivo. You said the condition is based on a header value - I'm not familiar with another way of evaluating headers inside the Apache config. Note that the redirect is internal to Apache (ie.: the client will not receive a 3xx response with a Location: header). I'd give that one a try - if it works please answer your own question. :-) – XCondE Dec 5 '10 at 6:51
I tried the [R] flag. It does an external redirect. That is consistent with the mod_rewrite documentation. But you deserve the bounty, your answer lead to the final solution. – Ivo Danihelka Dec 6 '10 at 10:37
up vote 2 down vote accepted

I was able to get the desired behavior, by asking for a different file, when the header is present:

RewriteCond %{HTTP:MyHeader} .+
RewriteRule .* index_symlink.php [QSA,L]

<Files "index_symlink.php">
    SSLOptions +ExportCertData
    SSLVerifyClient optional
share|improve this answer


if you receive headers formatted in a certain way, direct them to a server on another port configured as you wish, or another server on your LAN.

share|improve this answer

may be setup several http server instances (with diffirent configs) as back end and use proxy_mod/redirect on front end ?

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.