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

I'm trying to figure out why I can set a string literal in httpd.conf using SetEnv:

SetEnvIf anothertest ^$ something=sometext

But I can't assign the contents of another variable:

SetEnvIf anothertest ^$ something=$QUERY_STRING

The second one results in $QUERY_STRING instead of dereferencing the variable.

Update:

The above code was an attempt at troubleshooting an issue I'm having. The ultimate goal is to get the SetEnvIf working so that I can set multiple domains with Access-Control-Allow-Origin. I'm trying to set it for domain https://localhost:8443 and https://10.1.40.75:8443. Below is the code that I currently have which isn't working.

<ifModule mod_headers.c>
SetEnvIf Origin "^http(s)?://(.+\.)?(localhost:8443|10\.1\.40\.75:8443)$" origin_is=$0
Header always set Access-Control-Allow-Origin %{origin_is}e env=origin_is
Header set Access-Control-Allow-Credentials true
</ifModule>
share|improve this question
add comment

1 Answer

It's because Apache doesn't support that in the mod_setenvif module: http://httpd.apache.org/docs/2.2/mod/mod_setenvif.html

If you let us know what you're trying to achieve, perhaps one of us can suggest an alternative solution?

share|improve this answer
    
Updated the original question... –  opike Apr 13 '13 at 20:54
add comment

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.