LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices

Reply
 
Search this Thread
Old 03-19-2012, 06:23 PM   #1
Felipe
Member
 
Registered: Oct 2006
Posts: 294

Rep: Reputation: 31
How to add a new parameter with rewrite in Apache?


Hallo.

Apache/2.2/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 user in a 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:

RewriteEngine on
RewriteRule /application/login\.jsp /application/login.jsp?user=%{X_REMOTE_USER}e

But it doesn't work.

Whats wrong in the rule?

Thanks
 
Old 03-26-2012, 04:49 PM   #2
Felipe
Member
 
Registered: Oct 2006
Posts: 294

Original Poster
Rep: Reputation: 31
Finally, I've found the solution:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteRule ^/(.*)/login\.jsp$ /$1/login.jsp?user=%{LA-U:REMOTE_USER} [PT]

</IfModule>
 
  


Reply

Tags
apache2, rewriterule


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
add piping as parameter to a simple perl script frater Programming 5 02-03-2012 06:26 AM
Add parameter ust Linux - Newbie 3 09-09-2008 11:40 PM
apache rewrite help deesto Linux - Server 3 11-03-2006 02:07 PM
Unable to add parameter to /proc twk Red Hat 2 08-19-2006 10:52 AM
how to add -h parameter in script yulitao Programming 4 03-23-2004 07:30 PM


All times are GMT -5. The time now is 09:27 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration