Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Apache htaccess and perl

Reply
Thread Tools

Apache htaccess and perl

 
 
robertutah@gmail.com
Guest
Posts: n/a
 
      08-05-2006
Hi all

I have a apache running with mod_perl, it is set up with access-control
by a .htaccess-file with more than 1 user in it.

I need to get the username from the one that have logged in. How do I
do that ?

 
Reply With Quote
 
 
 
 
David Squire
Guest
Posts: n/a
 
      08-05-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> Hi all
>
> I have a apache running with mod_perl, it is set up with access-control
> by a .htaccess-file with more than 1 user in it.
>
> I need to get the username from the one that have logged in. How do I
> do that ?
>


It's a standard CGI environment variable: REMOTE_USER

You get access to environment variables in Perl via the %ENV hash.


DS
 
Reply With Quote
 
 
 
 
robertutah@gmail.com
Guest
Posts: n/a
 
      08-05-2006

David Squire skrev:

> (E-Mail Removed) wrote:
> > Hi all
> >
> > I have a apache running with mod_perl, it is set up with access-control
> > by a .htaccess-file with more than 1 user in it.
> >
> > I need to get the username from the one that have logged in. How do I
> > do that ?
> >

>
> It's a standard CGI environment variable: REMOTE_USER
>
> You get access to environment variables in Perl via the %ENV hash.
>
>
> DS


For some resson REMOTE_USER i not in %ENV ?

 
Reply With Quote
 
David Squire
Guest
Posts: n/a
 
      08-05-2006
(E-Mail Removed) wrote:
> David Squire skrev:
>
>> (E-Mail Removed) wrote:
>>> Hi all
>>>
>>> I have a apache running with mod_perl, it is set up with access-control
>>> by a .htaccess-file with more than 1 user in it.
>>>
>>> I need to get the username from the one that have logged in. How do I
>>> do that ?
>>>

>> It's a standard CGI environment variable: REMOTE_USER
>>
>> You get access to environment variables in Perl via the %ENV hash.
>>
>>
>> DS

>
> For some resson REMOTE_USER i not in %ENV ?
>


It works for me. Note that it is only set for pages protected using
..htaccess files - which you say you are using.

Please show us some code so that we have some chance of diagnosing your
problem.


DS
 
Reply With Quote
 
robertutah@gmail.com
Guest
Posts: n/a
 
      08-05-2006

David Squire skrev:

> (E-Mail Removed) wrote:
> > David Squire skrev:
> >
> >> (E-Mail Removed) wrote:
> >>> Hi all
> >>>
> >>> I have a apache running with mod_perl, it is set up with access-control
> >>> by a .htaccess-file with more than 1 user in it.
> >>>
> >>> I need to get the username from the one that have logged in. How do I
> >>> do that ?
> >>>
> >> It's a standard CGI environment variable: REMOTE_USER
> >>
> >> You get access to environment variables in Perl via the %ENV hash.
> >>
> >>
> >> DS

> >
> > For some resson REMOTE_USER i not in %ENV ?
> >

>
> It works for me. Note that it is only set for pages protected using
> .htaccess files - which you say you are using.
>
> Please show us some code so that we have some chance of diagnosing your
> problem.
>
>
> DS


# From my apache (one of the, got at apache running behind with
mod_perl this apache rewrite to it)
Maby this it the problem ?

<VirtualHost *>
ServerName somedomain.com

<Location />
AuthName MyDomain
AuthType basic
AuthUserFile /home/user/.htpasswd
require valid-user
</Location>

RewriteEngine On
RewriteCond %{REQUEST_URI} !^.*\.gif$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.jpeg$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.jpg$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.jpe$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.ico$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.css$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.html$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.htm$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.pdf$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.js$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.png$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.pl$ [NC]
RewriteCond %{REQUEST_URI} !^.*\.txt$ [NC]
RewriteRule ^(.*)$ http://127.0.0.1:8097$1 [P,NC]

<Directory />
AllowOverride AuthConfig
Order allow,deny
Allow from all
</Directory>


ServerAdmin (E-Mail Removed)
DocumentRoot /home/user/html
ErrorLog /home/user/log/error_log-admin
CustomLog /home/user/log/access_log-admin common
</VirtualHost>

 
Reply With Quote
 
David Squire
Guest
Posts: n/a
 
      08-05-2006
(E-Mail Removed) wrote:
> David Squire skrev:
>
>> (E-Mail Removed) wrote:
>>> David Squire skrev:
>>>
>>>> (E-Mail Removed) wrote:
>>>>> Hi all
>>>>>
>>>>> I have a apache running with mod_perl, it is set up with access-control
>>>>> by a .htaccess-file with more than 1 user in it.
>>>>>
>>>>> I need to get the username from the one that have logged in. How do I
>>>>> do that ?
>>>>>
>>>> It's a standard CGI environment variable: REMOTE_USER
>>>>
>>>> You get access to environment variables in Perl via the %ENV hash.
>>>>
>>> For some resson REMOTE_USER i not in %ENV ?
>>>

>> It works for me. Note that it is only set for pages protected using
>> .htaccess files - which you say you are using.
>>
>> Please show us some code so that we have some chance of diagnosing your
>> problem.
>>

> # From my apache (one of the, got at apache running behind with
> mod_perl this apache rewrite to it)
> Maby this it the problem ?
>
> <VirtualHost *>
> ServerName somedomain.com


[snip]

Show us your *Perl* code.


DS
 
Reply With Quote
 
robertutah@gmail.com
Guest
Posts: n/a
 
      08-05-2006

(E-Mail Removed) skrev:

> David Squire skrev:
>
> > (E-Mail Removed) wrote:
> > > David Squire skrev:
> > >
> > >> (E-Mail Removed) wrote:
> > >>> Hi all
> > >>>
> > >>> I have a apache running with mod_perl, it is set up with access-control
> > >>> by a .htaccess-file with more than 1 user in it.
> > >>>
> > >>> I need to get the username from the one that have logged in. How do I
> > >>> do that ?
> > >>>
> > >> It's a standard CGI environment variable: REMOTE_USER
> > >>
> > >> You get access to environment variables in Perl via the %ENV hash.
> > >>
> > >>
> > >> DS
> > >
> > > For some resson REMOTE_USER i not in %ENV ?
> > >

> >
> > It works for me. Note that it is only set for pages protected using
> > .htaccess files - which you say you are using.
> >
> > Please show us some code so that we have some chance of diagnosing your
> > problem.
> >
> >
> > DS

>
> # From my apache (one of the, got at apache running behind with
> mod_perl this apache rewrite to it)
> Maby this it the problem ?
>
> <VirtualHost *>
> ServerName somedomain.com
>
> <Location />
> AuthName MyDomain
> AuthType basic
> AuthUserFile /home/user/.htpasswd
> require valid-user
> </Location>
>
> RewriteEngine On
> RewriteCond %{REQUEST_URI} !^.*\.gif$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.jpeg$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.jpg$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.jpe$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.ico$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.css$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.html$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.htm$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.pdf$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.js$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.png$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.pl$ [NC]
> RewriteCond %{REQUEST_URI} !^.*\.txt$ [NC]
> RewriteRule ^(.*)$ http://127.0.0.1:8097$1 [P,NC]
>
> <Directory />
> AllowOverride AuthConfig
> Order allow,deny
> Allow from all
> </Directory>
>
>
> ServerAdmin (E-Mail Removed)
> DocumentRoot /home/user/html
> ErrorLog /home/user/log/error_log-admin
> CustomLog /home/user/log/access_log-admin common
> </VirtualHost>


I put my Auth-things in my second apache-conf, then i worked...

Thanks for all your help

 
Reply With Quote
 
 
 
Reply

Thread Tools

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
perl file(.pl) file in my htaccess doesn't work Nospam HTML 3 08-15-2006 05:32 PM
redirect to a perl script with htaccess Nospam HTML 3 05-27-2006 07:44 PM
Apache+MySQL+htaccess - nxt steps after authentication 11D.Universe@gmail.com Java 1 05-28-2005 08:36 PM
.htaccess and perl cgi Stoco Perl 0 01-12-2004 08:13 PM
How to test speed difference of Perl/Apache and SSI/Apache The Poor Perl Misc 2 09-27-2003 12:26 PM



Advertisments