You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by John McManigle <jo...@binx.mbhs.edu> on 2003/12/19 03:34:05 UTC

[users@httpd] mod_rewrite problem with LA-U:REMOTE_USER

Hi all,

I've had the toughest time trying to get mod_rewrite to work...

My specific goal: set up a system whereby a user is sent to his/her
own home directory upon authenticating.

Problem: It seems that however I configure things, apache takes
%{LA-U:REMOTE-USER} as empty.  (Also tried just %{REMOTE_USER} )

System: Running Debian GNU/Linux Stable, with Apache installed
from the testing tree using apt-get.  All other apache features
seem to work just fine, including other RewriteRules.
Server version: Apache/2.0.47
Server built:   Jul 15 2003 13:47:34


Attempts to solve & details:

I've searched the apache docs as well as this list's archives, and
it looks like the biggest hint is to do the lookahead thing rather
than just %{REMOTE_USER}  Tried that, doesn't work for me.

I'm putting my Rewrite statements in the virtual host file.  Some
of the permutations I've tried are:

RewriteLog /var/log/apache/myrewritelog
RewriteLogLevel 9
RewriteEngine on


RewriteRule ^/home/(.*) /~%{LA-U:REMOTE_USER}/$1

RewriteRule ^/home/(.*) /~%{REMOTE_USER}/$1

RewriteRule ^/home/(.*) /~%{LA-F:REMOTE_USER}/$1

RewriteRule ^/home/(.*) /~%{ENV:REMOTE_USER}/$1

RewriteRule ^/home/(.*) /~%{la-u:remote_user}/$1

RewriteCond %{la-u:remote_user} (.+)
RewriteRule ^/home/(.*) /~%1/$1 [R]


In all of these cases, it acts as though the remote user variable
is empty.  The client does authenticate correctly, and going to an
environment-printing CGI gives

<snip>
REMOTE_USER=jomcmani
AUTH_TYPE=Basic
GATEWAY_INTERFACE=CGI/1.1
SERVER_PROTOCOL=HTTP/1.1
<snip>


Looking at the rewrite log, we have things like this (a bit snipped):

[18/Dec/2003:18:56:15 --0500]  (2) init rewrite engine with requested 
uri /home/
[18/Dec/2003:18:56:15 --0500]  (3) applying pattern '^/home(.*)' to uri 
'/home/'
[18/Dec/2003:18:56:15 --0500]  (5) lookahead: path=/home/ 
var=REMOTE_USER -> val=
[18/Dec/2003:18:56:15 --0500]  (2) rewrite /home/ -> /~/


So clearly, this is incorrect....

Any suggestions about why this might be going bad, why I *can* see
the variable in a CGI, etc?

Thanks a lot for reading this far :-)  I hope there's some help out 
there.

John McManigle
Student Sysop and Webmaster
Montgomery Blair High School


---------------------------------------------------------------------
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