I want to Define
a variable from the value of what is received originally via nginx proxy_set_header MYVAR "some_value";
The variable should then be used in DocumentRoot
, Directory
and Alias
.
RewriteRule .* - [E=MYVAR:%{HTTP:MYVAR}]
SetEnv MYVAR "%{HTTP:MYVAR}"
Define MYVAR ${MYVAR}
This doesn't seem to be possible according the Apache documentation which only gives examples on how to set static values. So I tried this:
<If "%{HTTP:MYVAR} == 'value1'">
Define MYVAR value1
</If>
<If "%{HTTP:MYVAR} == 'value2'">
Define MYVAR value2
</If>
which doesn't work either. It always just executes the Define
from the last <If>
.
If I add
<Else>
Define MYVAR undefined
</Else>
this will be executed, so perhaps something wrong with my Syntax or that whole logic is not working as I think?
I'm running out of Ideas...
Edit: Is it possibly true that Define
generally doesn't work within <If>
?