我想弄清楚为什么我可以使用SetEnv在httpd.conf中设置string字面值:
SetEnvIf anothertest ^$ something=sometext
但是我不能指定另一个variables的内容:
SetEnvIf anothertest ^$ something=$QUERY_STRING
第二个导致$ QUERY_STRING而不是取消引用variables。
更新:
上面的代码是一个解决我遇到的问题的尝试。 最终目标是让SetEnvIf工作,以便我可以使用Access-Control-Allow-Origin来设置多个域。 我试图将其设置为域https://localhost:8443和https://10.1.40.75:8443 。 下面是我目前没有工作的代码。
<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>
这是因为Apache不支持mod_setenvif模块: http : mod_setenvif
如果你让我们知道你想达到什么目的,也许我们其中一个人可以提出一个替代解决scheme?