Hello,
I couldn't resist....
Here's a relatively simple bit of Header-Foo (as I like to call it):
<VirtualHost *>
ServerName headertest.dbvm.com
ServerAlias headertest.dbvm.com
ProxyPreserveHost On
RewriteEngine On
RewriteRule ^/$ /pls/apex/f?p=HEADERAPP:1 R=301
ProxyPass /pls/apex http://localhost:7777/pls/apex
ProxyPassReverse /pls/apex http://localhost:7777/pls/apex
ProxyPass /i http://localhost:7777/i
ProxyPassReverse /i http://localhost:7777/i
RewriteRule .* - E=AE_AUTHORIZATION:%{HTTP:Authorization}
RequestHeader set AE_AUTHORIZATION %{AE_AUTHORIZATION}e
RequestHeader unset HTTP_AUTHORIZATION
RequestHeader unset AUTHORIZATION
</VirtualHost>
You will also need to allow the new header to be passed through, using the OHS you'd add the following line to the DAD -
PlsqlCGIEnvironmentList AE_AUTHORIZATION
Using the EPG, you'd run this bit of code -
DBMS_EPG.SET_DAD_ATTRIBUTE (
dad_name => 'APEX',
attr_name => 'cgi-environment-list',
attr_value => 'AE_AUTHORIZATION');
This creates a new header (called AE_AUTHORIZATION) which contains the original values of the HTTP_AUTHORIZATION header, which is done in these lines:
RewriteRule .* - E=AE_AUTHORIZATION:%{HTTP:Authorization}
RequestHeader set AE_AUTHORIZATION %{AE_AUTHORIZATION}e
The next couple of lines remove the original AUTHORIZATION (HTTP_AUTHORIZATION) headers:
RequestHeader unset HTTP_AUTHORIZATION
RequestHeader unset AUTHORIZATION
I gave this a quick test, first without the above rules in place:
jes@AEMBP$ GET -H "AUTHORIZATION: FOO" headertest.dbvm.com | grep AUTHORIZATION
HTTP_AUTHORIZATION = FOO
AE_AUTHORIZATION =
Note that 'headertest.dbvm.com' is the VirtualHost entry for my application.
Notice that the HTTP_AUTHORIZATION header is set and the AE_AUTHORIZATION header is present (but empty).
Now trying the test with the rules in place -
jes@AEMBP$ GET -H "AUTHORIZATION: FOO" headertest.dbvm.com | grep AUTHORIZATION
AE_AUTHORIZATION = FOO
Notice how the AE_AUTHORIZATION header now contains the value of 'FOO' and the original AUTHORIZATION headers have gone.
This works for me, so it should work for you too (do let me know).
DISCLAIMER: PLEASE PLEASE (PLEASE!) don't try this on your production system without testing it out first on something you don't mind breaking. I am in no way responsible for any problems you hit if you choose to ignore this advice!
John.
http://jes.blogs.shellprompt.net
http://apex-evangelists.com