0

I have a request that contains the header X-Client-Cert and I need to assign it to another header from the virtual host configuration in apache. How can I do that?

RewriteEngine On

RequestHeader set NewHeader "%{X-Client-Cert}e" 

Thist solution doesn't work because X-Client-Cert is not an environment variable, however if I log the access log with

LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" \"%{X-Client-Cert}i\" " ssl_f
CustomLog "logs/access_fssl.log" ssl_f

I can see the content of X-Client-Cert

Is there any form of insert the content of X-Client-Cert into NewHeader user defined variable?

  • Are you really saying you can't see the difference between "%{X-Client-Cert}e" and "%{X-Client-Cert}i" ? – symcbean Dec 14 '15 at 13:12
  • "%{X-Client-Cert}e" should be an environment variable. As far as I know de "i" in "%{X-Client-Cert}i" is only used by the LogFormat to represent any http request header, – Manuel Vicente Dec 15 '15 at 09:25

1 Answers1

0

After some research, here is a possible solution that works!

RewriteCond %{HTTP:X-Client-Cert} (.+)
RewriteRule .* - [E=VAR:%1]

RequestHeader set WL-Proxy-Client-Cert "%{VAR}e"

Hope it helps somebody else!