You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Krist van Besien <kr...@gmail.com> on 2009/02/24 13:44:29 UTC
Re: [users@httpd] Mixing rewrite with authn_dbd: Rewriting based on
path value stored in mysql table
On Tue, Feb 24, 2009 at 12:58 PM, Roman Medina-Heigl Hernandez
<ro...@rs-labs.com> wrote:
>
> So for instance, accesing to http://isp/stats/ should:
> 1.- Ask for user/pass
> 2.- If the user exists in MySQL table (and password is ok), the path
> (associated to that user) should be retrieved from the same table. Let's
> say we have user "Tom" with path "/home/Tom".
> 3.- Finally Apache should serve /home/Tom/stats/.
>
> Is this achievable?
Achievable, but not in a trivial way. How you solve this also depends
on how fast this has to be. What you could do for example is
periodically export the user-path pairs to a DBM file, and us that as
a RewriteMap. That will be pretty fast, but changes to the MySQL table
will not reflect on your website immediately.
Krist
--
krist.vanbesien@gmail.com
krist@vanbesien.org
Bremgarten b. Bern, Switzerland
--
A: It reverses the normal flow of conversation.
Q: What's wrong with top-posting?
A: Top-posting.
Q: What's the biggest scourge on plain text email discussions?
---------------------------------------------------------------------
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] Mixing rewrite with authn_dbd: Rewriting based
on path value stored in mysql table
Posted by Roman Medina-Heigl Hernandez <ro...@rs-labs.com>.
Eric Covener escribió:
> On Tue, Feb 24, 2009 at 7:44 AM, Krist van Besien
> <kr...@gmail.com> wrote:
>> On Tue, Feb 24, 2009 at 12:58 PM, Roman Medina-Heigl Hernandez
>> <ro...@rs-labs.com> wrote:
>>> So for instance, accesing to http://isp/stats/ should:
>>> 1.- Ask for user/pass
>>> 2.- If the user exists in MySQL table (and password is ok), the path
>>> (associated to that user) should be retrieved from the same table. Let's
>>> say we have user "Tom" with path "/home/Tom".
>>> 3.- Finally Apache should serve /home/Tom/stats/.
>>>
>>> Is this achievable?
>> Achievable, but not in a trivial way. How you solve this also depends
>> on how fast this has to be. What you could do for example is
>> periodically export the user-path pairs to a DBM file, and us that as
>> a RewriteMap. That will be pretty fast, but changes to the MySQL table
>> will not reflect on your website immediately.
>
> This is a good idea, alternatively RewriteMap program would be lower
> performance but could look at the live data
Hello,
I haven't tested it yet but I think I found the optimum solution.
>From authn_dbd page [http://httpd.apache.org/docs/2.2/mod/mod_authn_dbd.html]:
"If httpd was built against APR version 1.3.0 or higher, any additional
column values in the first row returned by the query statement will be
stored as environment variables with names of the form AUTHENTICATE_COLUMN."
So it seems I could have an "AUTHENTICATE_PATH" envvar as result of SQL
query, and then I could use it in a rewrite rule...
I'm wondering whether the results to SQL queries are / aren't cached, both
REMOTE_USER and AUTHENTICATE_* envvars. Could somebody confirm it, please?
Cheers,
-r
---------------------------------------------------------------------
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] Mixing rewrite with authn_dbd: Rewriting based on
path value stored in mysql table
Posted by Eric Covener <co...@gmail.com>.
On Tue, Feb 24, 2009 at 7:44 AM, Krist van Besien
<kr...@gmail.com> wrote:
> On Tue, Feb 24, 2009 at 12:58 PM, Roman Medina-Heigl Hernandez
> <ro...@rs-labs.com> wrote:
>>
>> So for instance, accesing to http://isp/stats/ should:
>> 1.- Ask for user/pass
>> 2.- If the user exists in MySQL table (and password is ok), the path
>> (associated to that user) should be retrieved from the same table. Let's
>> say we have user "Tom" with path "/home/Tom".
>> 3.- Finally Apache should serve /home/Tom/stats/.
>>
>> Is this achievable?
>
> Achievable, but not in a trivial way. How you solve this also depends
> on how fast this has to be. What you could do for example is
> periodically export the user-path pairs to a DBM file, and us that as
> a RewriteMap. That will be pretty fast, but changes to the MySQL table
> will not reflect on your website immediately.
This is a good idea, alternatively RewriteMap program would be lower
performance but could look at the live data
--
Eric Covener
covener@gmail.com
---------------------------------------------------------------------
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