How to add username parameter with rewrite in Apache?

Discussion in 'Apache' started by FelipeGar, Mar 25, 2012.

  1. #1
    [HR][/HR] Hello.

    Apache2.2.22/Tomcat6 on Centos 5.5.

    I authenticate users in Apache using kerberos. In tomcat I can recover user using next configuration in Apache:

    ...
    AuthType Kerberos
    AuthName Autenticacion
    require valid-user

    RewriteEngine On
    RewriteRule .* - [E=RU:%{REMOTE_USER}]
    RequestHeader set X_REMOTE_USER %{RU}e

    But I'd like to send username as parameter:

    Ex:
    If receive /application/login.jsp

    Apache will rewrite the query and send Tomcat:

    /application/login.jsp?user=username

    I've tried with rewrite:


    <IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteRule ^/application/login\.jsp$ /application/login.jsp?user1=%{REMOTE_USER}&host=%{REMOTE_HOST}&ident=%{REMOTE_IDENT}&user2=%{RU}e [PT]
    </IfModule>

    I receive host with the remote host, but the other parameters are empty.

    I've alto tried to include the rule below the kerberos section, but it doesn't work

    Whats wrong in the rule?

    Thanks
     
    FelipeGar, Mar 25, 2012 IP