You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Nahor <na...@bravobrava.com> on 2004/03/24 02:35:18 UTC

[users@httpd] "SetEnvIf Remote_User" never matches

Hi guys,

I'm trying to set some environment variable depending on the logged user 
(in this case, to limit the scope of awstats).
Here is what I have in the .htaccess file in the awstats directory:

    Options +ExecCGI

    # Redirect non ssl request
    RewriteEngine On
    RewriteCond %{HTTPS} !=on
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R,L]

    DirectoryIndex awstats.cgi

    # Allow login either via pwauth (shawdow password) or .htpasswd
    AuthType             basic
    AuthName             "Web log"
    AuthExternal pwauth
    AuthExternalAuthoritative off
    AuthUserFile /var/www/localhost/.htpasswd_awstats
    require user user1 user2 user3

    # if user is user3, only show stats for test
    SetEnvIf Remote_User ^user3$ AWSTATS_FORCE_CONFIG=xxx.yyy.com


However, the env variable is never set. For testing, when I replace 
^user3$ with ^.*$ (match anything), the variable is correctly set. If I 
replace with ^.+$ (match any non-empty username), the variable is not 
set anymore. So it seems that Remote_User is always empty, even when 
someone logs in.
I also modified awstats.cgi to display the content of the REMOTE_USER 
environment variable and this one is always correctly set, it's never empty.

Does anyone have any idea about what's going on?

Thanks,
	Nahor


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


[users@httpd] Re: "SetEnvIf Remote_User" never matches

Posted by Nahor <na...@bravobrava.com>.
André Malo wrote:
> Hmm. mod_rewrite should do. Like:
> 
> RewriteCond %{REMOTE_USER} =user3
> RewriteRule ^ - [E=AWSTATS_FORCE_CONFIG:xxx.yyy.com]

Indeed it works. Thanks a lot!

	Nahor


---------------------------------------------------------------------
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] Re: "SetEnvIf Remote_User" never matches

Posted by André Malo <nd...@perlig.de>.
* Nahor <na...@bravobrava.com> wrote:

> >>    # if user is user3, only show stats for test
> >>    SetEnvIf Remote_User ^user3$ AWSTATS_FORCE_CONFIG=xxx.yyy.com

> > :-( It doesn't work. See
> > <http://issues.apache.org/bugzilla/show_bug.cgi?id=25725>
> 
> Thanks, do you (or somebody else) have an idea of how I could workaround 
> that issue? In a worst case scenario, I can use different URI but I 
> would prefer to avoid it as much as possible.

Hmm. mod_rewrite should do. Like:

RewriteCond %{REMOTE_USER} =user3
RewriteRule ^ - [E=AWSTATS_FORCE_CONFIG:xxx.yyy.com]

nd

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


[users@httpd] Re: "SetEnvIf Remote_User" never matches

Posted by Nahor <na...@bravobrava.com>.
André Malo wrote:

> * Nahor <na...@bravobrava.com> wrote:
> 
> 
>>    # if user is user3, only show stats for test
>>    SetEnvIf Remote_User ^user3$ AWSTATS_FORCE_CONFIG=xxx.yyy.com
>>
>>
>>However, the env variable is never set.
> 
> 
> :-( It doesn't work. See
> <http://issues.apache.org/bugzilla/show_bug.cgi?id=25725>

Thanks, do you (or somebody else) have an idea of how I could workaround 
that issue? In a worst case scenario, I can use different URI but I 
would prefer to avoid it as much as possible.

	Nahor


---------------------------------------------------------------------
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] "SetEnvIf Remote_User" never matches

Posted by André Malo <nd...@perlig.de>.
* Nahor <na...@bravobrava.com> wrote:

>     # if user is user3, only show stats for test
>     SetEnvIf Remote_User ^user3$ AWSTATS_FORCE_CONFIG=xxx.yyy.com
> 
> 
> However, the env variable is never set.

:-( It doesn't work. See
<http://issues.apache.org/bugzilla/show_bug.cgi?id=25725>

nd

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