问题原文
原帖链接 · CasualBen · CC BY-SA 4.0
I've a service which sets the header x-user_type. Since Apache2.4.33 cannot use this, i'll transform this with the following in a .htaccess:
<IfModule mod_headers.c>
<IfModule mod_setenvif.c>
SetEnvIfNoCase ^x.user.type$ ^(.*)$ fix_x-user_type=$1
RequestHeader set x-user-type %{fix_x-user_type}e env=fix_x-user_type
</IfModule>
</IfModule>
But if i supply x-user-type within a request then the value for x-user-type in the response is overwritten
Examples:
- Nothing supplied -> x-user-type = application (This is set by the service)
- x-user_type = test -> x-user-type = application (This is ok, since it is set by the service)
- x-user-type = test -> x-user-type = test (This should be application as well)
I think this is an apache configuration issue. Can someone help me solve this?
已采纳解答
原帖链接 · CasualBen · CC BY-SA 4.0
Fixed my own Problem with this: https://serverfault.com/a/900745/490242
Quote:
The value of a
RequestHeader setsupports expressions, and expressions include thereq(or http) function, which gives you the value of request headers. So this one directive should do what you want:
RequestHeader set X-CAS-email-primary "expr=%{req:X-CAS-email_primary}"You have to dig deep into the documentation to find this kind of thing, but it's there.Not sure why your configuration didn't work, but I guess the SetEnvIfNoCase is evaluated after the RequestHeader. The docs don't make it easy to figure that out.
Seems like SetEnvIfNoCase was my problem too.
摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。
