3

I have an application that runs behind Apache 2.4.27 that authenticates users with mod_auth_cas. This module stores attributes about the authenticated user in headers. I'm having issues with one header that's being stripped because it has an underscore in it (X-CAS-email_primary). After doing some searching, I added the code snippet below to the VirtualHost configuration.

SetEnvIfNoCase X-CAS-email_primary ^(.*)$ fix_header=$1
RequestHeader set X-CAS-email-primary %{fix_header}e env=fix_header

In case it wasn't obvious, I'm trying to change X-CAS-email_primary to X-CAS-email-primary. This code is partially working. The new header does appear but it has no value.

["HTTP_X_CAS_EMAIL_PRIMARY"]=> string(0) ""

I've confirmed that X-CAS-email_primary is set, so I'm not quite sure what's going on. Any suggestions?

Thanks!

1 Answer 1

2

The value of a RequestHeader set supports expressions, and expressions include the req (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.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .