• Apache httpd setting a custom header prefix

    From Hasitha Hettiarachchi@21:1/5 to All on Thu Jun 27 06:35:28 2019
    I'm using apache httpd24 to extract the headers from aws cognito and pass it to a JAVA application.

    AWS is sending me the following headers:

    username email firstname family_name

    And my target application has following attributes:

    username email firstname lastname

    I have a requirement to send the username and email headers with MELLON_ prefix (MELLON_username, MELLON_email). This does not require mod_auth_mellon. When i try to hardcode this

    Header add MELLON_username "someuser"
    RequestHeader set MELLON_username "someuser"
    Header add MELLON_email "someemail@test.com"
    RequestHeader set MELLON_email "someemail@test.com"
    it works, but when when i try to pass it with the variables coming from cognito, this doesn't work.

    For ex:

    Header add MELLON_username "expr=%{HTTP:X-Amzn-Oidc-Data}"
    RequestHeader set MELLON_username "expr=%{HTTP:X-Amzn-Oidc-Data}"
    RequestHeader edit MELLON_username "[^.]*." ""
    RequestHeader set MELLON_username "expr=%{unbase64:%{HTTP:username}}" RequestHeader edit MELLON_username "(.*?)(?:\"username\":\")(.*?)(?:\")(.*$)" $2


    username gets null with this.

    I tried setting this as an env variable with the mod_setenvif module as some other forms suggested, but still no luck. Has anyone come across something like this?

    Thanks.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)