1

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?

4
+50

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>
3
  • It is a nice idea. Is the redirect needed? The configuration may even be done in .htaccess, if using <Files> instead of <Location>. 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. :-) 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. Dec 6 '10 at 10:37
2

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>
1

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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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