Return-Path: X-Original-To: apmail-perl-modperl-archive@www.apache.org Delivered-To: apmail-perl-modperl-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 48D6917E3D for ; Tue, 3 Mar 2015 04:28:15 +0000 (UTC) Received: (qmail 59296 invoked by uid 500); 3 Mar 2015 04:28:00 -0000 Delivered-To: apmail-perl-modperl-archive@perl.apache.org Received: (qmail 59256 invoked by uid 500); 3 Mar 2015 04:28:00 -0000 Mailing-List: contact modperl-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list modperl@perl.apache.org Received: (qmail 59246 invoked by uid 99); 3 Mar 2015 04:28:00 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Mar 2015 04:28:00 +0000 X-ASF-Spam-Status: No, hits=-0.7 required=5.0 tests=RCVD_IN_DNSWL_LOW X-Spam-Check-By: apache.org Received-SPF: error (athena.apache.org: local policy) Received: from [209.85.217.178] (HELO mail-lb0-f178.google.com) (209.85.217.178) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 03 Mar 2015 04:27:55 +0000 Received: by lbiw7 with SMTP id w7so34602113lbi.10 for ; Mon, 02 Mar 2015 20:27:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=Z86/XY4uiw5CG0ZKJ/9AiW4wUssP1ZNM44/cUr5+QDo=; b=FxZVphAAmfQQHA6HNkcJZkmqlng+PXNs2xxhta7fIFTRo0of0QZ1XnsG01VdV9iLyb 5rgrHP7Q12nC5YQaMWSUkMxWdTue3CbQEebBkEGVtBatcxHvgcTwg5c+CHxv7+3Xgcye ucyzwBdEvCNR/RXEMruXgGiQZlBVqrjjQVhRyR/z4ziKcwzmGPiz9irj8957s0AIHv0/ EWwsIoqubifI6Gz8VRHVG4wLGjrIWJy1q54CQKoGPC+rrvIzubBzr7HVYqMpusd1FpI+ cf5jRknf73fAsO9kpPEYbcRbvXiADHJnWTkJnZ1U5DyDdVBlFcYfPaA6O6xag4thQpkV D7AA== X-Gm-Message-State: ALoCoQlVIYpcW9ATJZrhuDyn7MhBXmYgMhRg5laDQqj2J4ZTnnfUtlWWJELAobyvZ4nuwgXEfEaR MIME-Version: 1.0 X-Received: by 10.152.23.3 with SMTP id i3mr11509092laf.97.1425356834131; Mon, 02 Mar 2015 20:27:14 -0800 (PST) Received: by 10.25.30.5 with HTTP; Mon, 2 Mar 2015 20:27:14 -0800 (PST) In-Reply-To: <45425815-EBA2-4711-8BA1-16CFA6168529@justatheory.com> References: <45425815-EBA2-4711-8BA1-16CFA6168529@justatheory.com> Date: Mon, 2 Mar 2015 20:27:14 -0800 Message-ID: Subject: Re: How Do I change the Document Root Per Request From: Fred Moyer To: "David E. Wheeler" Cc: mod_perl list Content-Type: text/plain; charset=UTF-8 X-Virus-Checked: Checked by ClamAV on apache.org Can you show us your relevant httpd.conf snippet? No guesses right now, but that might help. On Sun, Mar 1, 2015 at 4:46 PM, David E. Wheeler wrote: > Hi, > > I want to set the document root for a request to map to the basic auth username. I tried this in a PerlFixupHandler: > > sub handler { > my $r = shift; > > # We only want to do this once per request. > return DECLINED unless $r->is_initial_req; > > # Get the username. > my $user = $r->user or return HTTP_UNAUTHORIZED; > > # Return forbidden if the username subdiectory does not exist. > my $doc_root = File::Spec->catdir($r->document_root, $user); > return HTTP_FORBIDDEN unless -d $doc_root; > > # Set the document root for the duration of this request and return. > $r->document_root($doc_root); > return DECLINED; > } > > But alas, it still serves the original document root. How can I get it to change the document root on a per-request basis? If I cant, should I change the URI or the filename, instead? > > Thnks, > > David