You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Cenk Oguz <ce...@bredband.net> on 2008/02/04 21:14:43 UTC

[users@httpd] modifying header in request

Hi!

I am currently trying to add the REMOTE_USER environment variable into a response header or forward header (using mod_jk).

However we also need to strip the first few characters of the REMOTE_USER when adding it to the header.

We are adding the header to the request response using mod_headers, however in apache 2.0 mod_headers does not support modifying a header using the "edit" action with regexps.

We have noticed the "edit" action for mod_headers directives only exist in apache 2.2.

Is there any way of doing this modification of REMOTE_USER when adding it to a header without upgrading to Apache 2.2? We can not do so due to other module dependencies.

Regards,
Cenk

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] modifying header in request

Posted by Cenk Oguz <ce...@bredband.net>.
Thanks for the advice Eric!

I looked it up and found information and examples like the one below. However the X_REMOTE_USER header always comes out empty, I can not figure out why. I can see that REMOTE_USER indeed contains an authentic username. According to mod_rewrite documentation the below directives should work out. Think I have seen other examples where it does not work either.

Is the code looking right? Is there a reason it should not work out on Apache httpd 2.0 on the win32 platform?

RewriteCond %{LA-U:REMOTE_USER} (.+)
RewriteRule ^(.*) - [L,P,E=RU:%1]
RequestHeader add X_REMOTE_USER %{RU}e 

/Cenk



On Mon, Feb 04, 2008 at 06:32:43PM -0500, Eric Covener wrote:
> On Feb 4, 2008 3:14 PM, Cenk Oguz <ce...@bredband.net> wrote:
> > Hi!
> >
> > I am currently trying to add the REMOTE_USER environment variable into a response header or forward header (using mod_jk).
> >
> > However we also need to strip the first few characters of the REMOTE_USER when adding it to the header.
> >
> > We are adding the header to the request response using mod_headers, however in apache 2.0 mod_headers does not support modifying a header using the "edit" action with regexps.
> 
> 
> Can you use a rewritecond to capture what you want, drop it in a new
> envvar [E=FOO:BAR], then use mod_headers to set the response header
> from your the new envvar?
> 
> -- 
> Eric Covener
> covener@gmail.com
> 
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] modifying header in request

Posted by Eric Covener <co...@gmail.com>.
On Feb 4, 2008 3:14 PM, Cenk Oguz <ce...@bredband.net> wrote:
> Hi!
>
> I am currently trying to add the REMOTE_USER environment variable into a response header or forward header (using mod_jk).
>
> However we also need to strip the first few characters of the REMOTE_USER when adding it to the header.
>
> We are adding the header to the request response using mod_headers, however in apache 2.0 mod_headers does not support modifying a header using the "edit" action with regexps.


Can you use a rewritecond to capture what you want, drop it in a new
envvar [E=FOO:BAR], then use mod_headers to set the response header
from your the new envvar?

-- 
Eric Covener
covener@gmail.com

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org