Only thee following directives in the .htaccess file
SetEnvIf _ .* SSS=1
<If "%{ENV:SSS} -eq 1">
Header set MyHeader 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-%{SSS}e'
</If>
<Else>
Header set MyHeader 'yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy-%{SSS}e'
</Else>
Looking into the response headers the condition is never met. Whatever I try, -eq. -ne, ==, != etc.
At the same time -%{SSS}e always shows 1 in any condition.
If has "high priority" and executes while SSS is undefined? Well,
<If "%{ENV:SSS} == ''">
always evaluates to true xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx-1. How that is possible - In the evaluation variable is not defined, but within the condition processing it is?
Where do I make mistake - unable to find any clue what's wrong.
Why I do that in general - I need to check if specific conditions are met using rewriterules setting variables [E:VAR:VAL], and after that processing I check final conditions to set specific headers. But this If condition messes everything because if is being executed out of order?
Update: all the variables set in the course of working on .htaccess are defined within the If or Else when their execution starts, but the If condition evaluation seems to be performed before those variables got defined.
I do not care how to achieve the result - is there any other way to conditionally execute Header set command with variable injection without using If?
SetEnvIf. Possible to legitimately defer the If to evaluate the last? If this is an actual issue...SetEnvIf _ .* SSS=1- What is the underscore (first argument) referencing here? This doesn't set the env var "unconditionally", if that is the intention?