Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

For example, something like:

<IfHeader "MyHeader">
  SSLOptions +ExportCertData
  SSLVerifyClient optional
</IfHeader>

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

share|improve this question

4 Answers 4

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$">
(...)
</Location>
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
</Files>
share|improve this answer

proxying.

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

 
discard

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.