perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Fred Moyer <f...@redhotpenguin.com>
Subject Re: How Do I change the Document Root Per Request
Date Tue, 03 Mar 2015 04:27:14 GMT
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 <david@justatheory.com> 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

Mime
View raw message