Return-Path: Delivered-To: apmail-httpd-users-archive@www.apache.org Received: (qmail 27759 invoked from network); 25 Feb 2009 13:20:41 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Feb 2009 13:20:41 -0000 Received: (qmail 31053 invoked by uid 500); 25 Feb 2009 13:20:30 -0000 Delivered-To: apmail-httpd-users-archive@httpd.apache.org Received: (qmail 31035 invoked by uid 500); 25 Feb 2009 13:20:29 -0000 Mailing-List: contact users-help@httpd.apache.org; run by ezmlm Precedence: bulk Reply-To: users@httpd.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list users@httpd.apache.org Received: (qmail 31026 invoked by uid 99); 25 Feb 2009 13:20:29 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Feb 2009 05:20:29 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=FM_FAKE_HELO_VERIZON,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of donovant@bellatlantic.net designates 206.46.173.7 as permitted sender) Received: from [206.46.173.7] (HELO vms173007pub.verizon.net) (206.46.173.7) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 25 Feb 2009 13:20:20 +0000 Received: from [192.168.11.2] ([70.22.228.110]) by vms173007.mailsrvcs.net (Sun Java(tm) System Messaging Server 6.3-7.04 (built Sep 26 2008; 32bit)) with ESMTPA id <0KFM00IFIICZ60M2@vms173007.mailsrvcs.net> for users@httpd.apache.org; Wed, 25 Feb 2009 07:19:47 -0600 (CST) Message-id: <49A54573.6010004@bellatlantic.net> Date: Wed, 25 Feb 2009 08:19:47 -0500 From: Tom Donovan Reply-to: Tom.Donovan@acm.org User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-version: 1.0 To: users@httpd.apache.org References: <49A3E0CA.5080905@rs-labs.com> In-reply-to: <49A3E0CA.5080905@rs-labs.com> Content-type: text/plain; charset=ISO-8859-1; format=flowed Content-transfer-encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Subject: Re: [users@httpd] Mixing rewrite with authn_dbd: Rewriting based on path value stored in mysql table Roman Medina-Heigl Hernandez wrote: > Hello, > > I'm working on an ISP/Hosting environment and I'm having trouble to figure > out how to solve a problem which (I think) involves mixing several > modules/concepts: > - pages should be protected with basic-auth where user database should > reside on MySQL (mod_authn_dbd). The mysql table basically contains 3 > fields: user, password and path > - pages should be rewritten (mod_rewrite) based on authenticated user *and* > the path associated to that user. > > 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? > It may not be possible to do what you want. Apache locates the file to serve before deciding whether to prompt for authentication. For example: even if authentication is required for /home - there may be "Satisfy Any" and "Allow from all" directives for /home/Mary. If the "AllowOverride AuthConfig" directive is specified - there might be a .htaccess file in /home/Mary which prevents authentication from being needed. In either case, access to /home/Mary doesn't require authentication, and shouldn't prompt for it. This is why the steps are: 1.) determine the file Apache should serve 2.) decide if authentication is needed for this file, based on its directory or parent directories, or directives contained in , , .htaccess, etc. 3.) prompt for authentication only if it is needed It's a catch-22 to require the results of authentication to determine which file to serve. You might say "I don't do any of those things which prevent authentication" - but it is not easy for Apache to consider in advance all the possibilities that "http://isp/stats/ " might get re-written to, and then check that there are none of "those things" for any of them before prompting a user for authentication. -tom- --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See 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