OK I have spent all day on this--
I'm using apache with mod_ssl I'm trying to take an existing environment header, "%{SSL_CLIENT_S_DN_CN}s" which looks like "Lastname Firstname Mi username" and set a new header called USERNAME and set that equal to just username (the characters between the last space and the end of the string)
I would then reverse proxy that header to a backend host which would use it to identify the user.
I have tried a lot of different things. I don't know if the problem is that I don't understand perl regex or if I don't understand the syntax or I'm not putting it in the right place, or all three.
Here is an example of one thing I tried:
SetEnvIf SSL_CLIENT_S_DN_CN (.*\ )(.*) newhostname=$2
RequestHeader set HOSTNAME "%{newhostname}e"
All I really want is a new header Hostname to equal the last non-whitespace characters in the DN_CN environment variable.